aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Lo <loj@cisco.com>2016-07-25 14:34:48 -0400
committerJohn Lo <loj@cisco.com>2016-07-25 14:34:48 -0400
commit1d9897882360d5a8034a770e0408dadeb6ea5b79 (patch)
tree0f9039f2ef52f7ee017e326cde18a1605213f411
parent9d716cdc3bab6f2772136afa276e2208278b14cf (diff)
VPP-142 - Follow up fix for shared_count in indirect adjacencies
Change-Id: Ia2d0351ffd40c75cbf9611e00a7e111189ad70b5 Signed-off-by: John Lo <loj@cisco.com>
-rw-r--r--vnet/vnet/ip/ip4_forward.c7
-rw-r--r--vnet/vnet/ip/ip6_forward.c8
2 files changed, 11 insertions, 4 deletions
diff --git a/vnet/vnet/ip/ip4_forward.c b/vnet/vnet/ip/ip4_forward.c
index 97e472b63c7..d2e761fe9ea 100644
--- a/vnet/vnet/ip/ip4_forward.c
+++ b/vnet/vnet/ip/ip4_forward.c
@@ -455,8 +455,11 @@ ip4_add_del_route_next_hop (ip4_main_t * im,
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;
}
diff --git a/vnet/vnet/ip/ip6_forward.c b/vnet/vnet/ip/ip6_forward.c
index 80156e03f38..823daa69699 100644
--- a/vnet/vnet/ip/ip6_forward.c
+++ b/vnet/vnet/ip/ip6_forward.c
@@ -516,8 +516,12 @@ ip6_add_del_route_next_hop (ip6_main_t * im,
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;
}