Change-Id: Ia2d0351ffd40c75cbf9611e00a7e111189ad70b5
Signed-off-by: John Lo <loj@cisco.com>
ip4_add_del_route (im, &a);
- /* adjust share count. This cannot be the only use of the adjacency */
- nh_adj->share_count += is_del ? -1 : 1;
+ /* adjust share count. This cannot be the only use of the adjacency
+ unless next hop is an indiect adj where share count is already
+ incremented */
+ if (next_hop_sw_if_index != ~0)
+ nh_adj->share_count += is_del ? -1 : 1;
goto done;
}
a.n_add_adj = 0;
ip6_add_del_route (im, &a);
- /* adjust share count. This cannot be the only use of the adjacency */
- nh_adj->share_count += is_del ? -1 : 1;
+
+ /* adjust share count. This cannot be the only use of the adjacency
+ unless next hop is an indiect adj where share count is already
+ incremented */
+ if (next_hop_sw_if_index != ~0)
+ nh_adj->share_count += is_del ? -1 : 1;
goto done;
}