aboutsummaryrefslogtreecommitdiffstats
path: root/vnet/vnet/ethernet/arp.c
diff options
context:
space:
mode:
authorKeith Burns (alagalah) <alagalah@gmail.com>2016-06-29 07:07:16 -0700
committerKeith Burns (alagalah) <alagalah@gmail.com>2016-06-29 07:07:16 -0700
commit71fb06fba05ff74390f4ff013ff14ea1086ab631 (patch)
tree948b7c0b06866195ee24776be39791688ff49125 /vnet/vnet/ethernet/arp.c
parent0f8ecf0eb267d580da4d963a0e0420eb15238d78 (diff)
Don't re-write adjacency with same information.
This will cause FIB counters to appear to be reset. This is an implementation of a patch from Dave Barach. Change-Id: I19b9953d42dfb92ec22af6a855e2e519ae7c3bdc Signed-off-by: Keith Burns (alagalah) <alagalah@gmail.com>
Diffstat (limited to 'vnet/vnet/ethernet/arp.c')
-rw-r--r--vnet/vnet/ethernet/arp.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/vnet/vnet/ethernet/arp.c b/vnet/vnet/ethernet/arp.c
index d9e4b9b2612..fa13d52603b 100644
--- a/vnet/vnet/ethernet/arp.c
+++ b/vnet/vnet/ethernet/arp.c
@@ -399,6 +399,7 @@ vnet_arp_set_ip4_over_ethernet_internal (vnet_main_t * vnm,
/* Note: always install the route. It might have been deleted */
memset(&adj, 0, sizeof(adj));
adj.lookup_next_index = IP_LOOKUP_NEXT_REWRITE;
+ adj.n_adj = 1; /* otherwise signature compare fails */
vnet_rewrite_for_sw_interface
(vnm,
@@ -432,15 +433,22 @@ vnet_arp_set_ip4_over_ethernet_internal (vnet_main_t * vnm,
}
else
{
- /* create new adj */
- args.table_index_or_table_id = fib_index;
- args.flags = IP4_ROUTE_FLAG_FIB_INDEX | IP4_ROUTE_FLAG_ADD | IP4_ROUTE_FLAG_NEIGHBOR;
- args.dst_address = a->ip4;
- args.dst_address_length = 32;
- args.adj_index = ~0;
- args.add_adj = &adj;
- args.n_add_adj = 1;
- ip4_add_del_route (im, &args);
+ /* Check that new adjacency actually isn't exactly the same as
+ * what is already there. If we over-write the adjacency with
+ * exactly the same info, its technically a new adjacency with
+ * new counters, but to user it appears as counters reset.
+ */
+ if (vnet_ip_adjacency_share_compare (&adj, existing_adj) == 0) {
+ /* create new adj */
+ args.table_index_or_table_id = fib_index;
+ args.flags = IP4_ROUTE_FLAG_FIB_INDEX | IP4_ROUTE_FLAG_ADD | IP4_ROUTE_FLAG_NEIGHBOR;
+ args.dst_address = a->ip4;
+ args.dst_address_length = 32;
+ args.adj_index = ~0;
+ args.add_adj = &adj;
+ args.n_add_adj = 1;
+ ip4_add_del_route (im, &args);
+ }
}
if (make_new_arp_cache_entry)