ip: Protocol Independent IP Neighbors

Type: feature

 - ip-neighbour: generic neighbour handling; APIs, DBs, event handling,
aging
 - arp: ARP protocol implementation
 - ip6-nd; IPv6 neighbor discovery implementation; separate ND,
MLD, RA
 - ip6-link; manage link-local addresses
 - l2-arp-term; events separated from IP neighbours, since they are not
the same.

vnet retains just enough education to perform ND/ARP packet
construction.
arp and ip6-nd to be moved to plugins soon.

Change-Id: I88dedd0006b299344f4c7024a0aa5baa6b9a8bbe
Signed-off-by: Neale Ranns <nranns@cisco.com>
diff --git a/src/plugins/abf/test/test_abf.py b/src/plugins/abf/test/test_abf.py
index 7cffdac..6ba6039 100644
--- a/src/plugins/abf/test/test_abf.py
+++ b/src/plugins/abf/test/test_abf.py
@@ -141,7 +141,6 @@
         for i in self.pg_interfaces:
             i.unconfig_ip4()
             i.unconfig_ip6()
-            i.ip6_disable()
             i.admin_down()
         super(TestAbf, self).tearDown()
 
diff --git a/src/plugins/acl/test/test_acl_plugin_conns.py b/src/plugins/acl/test/test_acl_plugin_conns.py
index ac9e7c1..f4cf594 100644
--- a/src/plugins/acl/test/test_acl_plugin_conns.py
+++ b/src/plugins/acl/test/test_acl_plugin_conns.py
@@ -152,7 +152,7 @@
         super(ACLPluginConnTestCase, self).tearDown()
 
     def show_commands_at_teardown(self):
-        self.logger.info(self.vapi.cli("show ip arp"))
+        self.logger.info(self.vapi.cli("show ip neighbors"))
         self.logger.info(self.vapi.cli("show ip6 neighbors"))
         self.logger.info(self.vapi.cli("show acl-plugin sessions"))
         self.logger.info(self.vapi.cli("show acl-plugin acl"))
diff --git a/src/plugins/acl/test/test_acl_plugin_l2l3.py b/src/plugins/acl/test/test_acl_plugin_l2l3.py
index 6aaf420..3379871 100644
--- a/src/plugins/acl/test/test_acl_plugin_l2l3.py
+++ b/src/plugins/acl/test/test_acl_plugin_l2l3.py
@@ -113,7 +113,7 @@
     def tearDown(self):
         """Run standard test teardown and log ``show l2patch``,
         ``show l2fib verbose``,``show bridge-domain <bd_id> detail``,
-        ``show ip arp``.
+        ``show ip neighbors``.
         """
         super(TestACLpluginL2L3, self).tearDown()
 
@@ -123,8 +123,7 @@
         self.logger.info(self.vapi.cli("show l2fib verbose"))
         self.logger.info(self.vapi.cli("show bridge-domain %s detail" %
                                        self.bd_id))
-        self.logger.info(self.vapi.cli("show ip arp"))
-        self.logger.info(self.vapi.cli("show ip6 neighbors"))
+        self.logger.info(self.vapi.cli("show ip neighbors"))
         cmd = "show acl-plugin sessions verbose 1"
         self.logger.info(self.vapi.cli(cmd))
         self.logger.info(self.vapi.cli("show acl-plugin acl"))
diff --git a/src/plugins/dhcp/dhcp6_ia_na_client_cp.c b/src/plugins/dhcp/dhcp6_ia_na_client_cp.c
index f9c379c..b485599 100644
--- a/src/plugins/dhcp/dhcp6_ia_na_client_cp.c
+++ b/src/plugins/dhcp/dhcp6_ia_na_client_cp.c
@@ -20,6 +20,7 @@
 #include <dhcp/dhcp6_ia_na_client_dp.h>
 #include <vnet/ip/ip.h>
 #include <vnet/ip/ip6.h>
+#include <vnet/ip/ip6_link.h>
 #include <float.h>
 #include <math.h>
 
@@ -144,17 +145,6 @@
 
 static void interrupt_process (void);
 
-static u32
-ip6_enable (u32 sw_if_index)
-{
-  dhcp6_client_cp_main_t *rm = &dhcp6_client_cp_main;
-  clib_error_t *rv;
-
-  rv = enable_ip6_interface (rm->vlib_main, sw_if_index);
-
-  return rv != 0;
-}
-
 static u8
 ip6_addresses_equal (ip6_address_t * address1, ip6_address_t * address2)
 {
@@ -422,7 +412,7 @@
                     clib_warning ("Failed to delete interface address");
                 pool_put (rm->address_pool, address_info);
                 /* make sure ip6 stays enabled */
-                ip6_enable (sw_if_index);
+                ip6_link_enable (sw_if_index);
                 client_state = &rm->client_state_by_sw_if_index[sw_if_index];
                 if (--client_state->address_count == 0)
                   {
@@ -650,7 +640,7 @@
 	  dhcp6_clients_enable_disable (1);
 	}
 
-      ip6_enable (sw_if_index);
+      ip6_link_enable (sw_if_index);
       send_client_message_start_stop (sw_if_index, ~0, DHCPV6_MSG_SOLICIT,
 				      0, 1);
     }
diff --git a/src/plugins/dhcp/dhcp6_ia_na_client_dp.c b/src/plugins/dhcp/dhcp6_ia_na_client_dp.c
index 8ad7d76..3cf2fb1 100644
--- a/src/plugins/dhcp/dhcp6_ia_na_client_dp.c
+++ b/src/plugins/dhcp/dhcp6_ia_na_client_dp.c
@@ -20,7 +20,7 @@
 #include <vnet/mfib/ip6_mfib.h>
 #include <vnet/fib/fib.h>
 #include <vnet/adj/adj_mcast.h>
-#include <vnet/ip/ip6_neighbor.h>
+#include <vnet/ip/ip6_link.h>
 #include <dhcp/dhcp6_ia_na_client_dp.h>
 #include <dhcp/dhcp6_client_common_dp.h>
 #include <vnet/ip/ip_types_api.h>
@@ -89,16 +89,16 @@
   ip6_header_t *ip;
   udp_header_t *udp;
   dhcpv6_header_t *dhcp;
-  ip6_address_t src_addr;
+  const ip6_address_t *src_addr;
   u32 dhcp_opt_len = 0;
   client_state->transaction_start = vlib_time_now (vm);
   u32 n_addresses;
   u32 i;
 
   /* Get a link-local address */
-  src_addr = ip6_neighbor_get_link_local_address (sw_if_index);
+  src_addr = ip6_get_link_local_address (sw_if_index);
 
-  if (src_addr.as_u8[0] != 0xfe)
+  if (src_addr->as_u8[0] != 0xfe)
     {
       clib_warning ("Could not find source address to send DHCPv6 packet");
       return NULL;
@@ -123,7 +123,7 @@
   udp = (udp_header_t *) (ip + 1);
   dhcp = (dhcpv6_header_t *) (udp + 1);
 
-  ip->src_address = src_addr;
+  ip->src_address = *src_addr;
   ip->hop_limit = 255;
   ip->ip_version_traffic_class_and_flow_label =
     clib_host_to_net_u32 (0x6 << 28);
diff --git a/src/plugins/dhcp/dhcp6_pd_client_cp.c b/src/plugins/dhcp/dhcp6_pd_client_cp.c
index ec9e5c6..1846627 100644
--- a/src/plugins/dhcp/dhcp6_pd_client_cp.c
+++ b/src/plugins/dhcp/dhcp6_pd_client_cp.c
@@ -19,7 +19,8 @@
 #include <dhcp/dhcp6_pd_client_dp.h>
 #include <vnet/ip/ip.h>
 #include <vnet/ip/ip6.h>
-#include <vnet/ip/ip6_neighbor.h>
+#include <vnet/ip/ip6_link.h>
+#include <vnet/ip6-nd/ip6_ra.h>
 #include <float.h>
 #include <math.h>
 #include <string.h>
@@ -243,17 +244,6 @@
 
 static void interrupt_process (void);
 
-static u32
-ip6_enable (u32 sw_if_index)
-{
-  dhcp6_pd_client_cp_main_t *rm = &dhcp6_pd_client_cp_main;
-  clib_error_t *rv;
-
-  rv = enable_ip6_interface (rm->vlib_main, sw_if_index);
-
-  return rv != 0;
-}
-
 static u8
 ip6_prefixes_equal (ip6_address_t * prefix1, ip6_address_t * prefix2, u8 len)
 {
@@ -807,16 +797,15 @@
   addr.as_u64[0] &= im->fib_masks[address_info->prefix_length].as_u64[0];
   addr.as_u64[1] &= im->fib_masks[address_info->prefix_length].as_u64[1];
 
-  rv = ip6_neighbor_ra_prefix (vm, address_info->sw_if_index,
-			       &addr, address_info->prefix_length,
-			       0 /* use_default */ ,
-			       prefix_info->valid_lt,
-			       prefix_info->preferred_lt,
-			       0 /* no_advertise */ ,
-			       0 /* off_link */ ,
-			       0 /* no_autoconfig */ ,
-			       0 /* no_onlink */ ,
-			       enable == 0 /* is_no */ );
+  rv = ip6_ra_prefix (vm, address_info->sw_if_index,
+		      &addr, address_info->prefix_length,
+		      0 /* use_default */ ,
+		      prefix_info->valid_lt,
+		      prefix_info->preferred_lt, 0 /* no_advertise */ ,
+		      0 /* off_link */ ,
+		      0 /* no_autoconfig */ ,
+		      0 /* no_onlink */ ,
+		      enable == 0 /* is_no */ );
   if (rv != 0)
     {
       clib_warning ("ip6_neighbor_ra_prefix returned %d", rv);
@@ -1268,7 +1257,7 @@
 	  dhcp6_clients_enable_disable (1);
 	}
 
-      ip6_enable (sw_if_index);
+      ip6_link_enable (sw_if_index);
       send_client_message_start_stop (sw_if_index, ~0, DHCPV6_MSG_SOLICIT,
 				      0, 1);
     }
@@ -1387,6 +1376,8 @@
 };
 /* *INDENT-ON* */
 
+#include <vlib/unix/plugin.h>
+
 static clib_error_t *
 dhcp_pd_client_cp_init (vlib_main_t * vm)
 {
diff --git a/src/plugins/dhcp/dhcp6_pd_client_dp.c b/src/plugins/dhcp/dhcp6_pd_client_dp.c
index 7896e9a..980c83c 100644
--- a/src/plugins/dhcp/dhcp6_pd_client_dp.c
+++ b/src/plugins/dhcp/dhcp6_pd_client_dp.c
@@ -20,10 +20,10 @@
 #include <vnet/mfib/ip6_mfib.h>
 #include <vnet/fib/fib.h>
 #include <vnet/adj/adj_mcast.h>
-#include <vnet/ip/ip6_neighbor.h>
 #include <dhcp/dhcp6_pd_client_dp.h>
 #include <dhcp/dhcp6_client_common_dp.h>
 #include <vnet/ip/ip_types_api.h>
+#include <vnet/ip/ip6_link.h>
 
 dhcp6_pd_client_main_t dhcp6_pd_client_main;
 dhcp6_pd_client_public_main_t dhcp6_pd_client_public_main;
@@ -90,7 +90,7 @@
   ip6_header_t *ip;
   udp_header_t *udp;
   dhcpv6_header_t *dhcp;
-  ip6_address_t src_addr;
+  const ip6_address_t *src_addr;
   u32 dhcp_opt_len = 0;
   client_state->transaction_start = vlib_time_now (vm);
   u32 n_prefixes;
@@ -102,9 +102,9 @@
    */
 
   /* Get a link-local address */
-  src_addr = ip6_neighbor_get_link_local_address (sw_if_index);
+  src_addr = ip6_get_link_local_address (sw_if_index);
 
-  if (src_addr.as_u8[0] != 0xfe)
+  if (src_addr->as_u8[0] != 0xfe)
     {
       clib_warning ("Could not find source address to send DHCPv6 packet");
       return NULL;
@@ -129,7 +129,7 @@
   udp = (udp_header_t *) (ip + 1);
   dhcp = (dhcpv6_header_t *) (udp + 1);
 
-  ip->src_address = src_addr;
+  ip->src_address = *src_addr;
   ip->hop_limit = 255;
   ip->ip_version_traffic_class_and_flow_label =
     clib_host_to_net_u32 (0x6 << 28);
diff --git a/src/plugins/dhcp/test/test_dhcp.py b/src/plugins/dhcp/test/test_dhcp.py
index 07db35d..065683f 100644
--- a/src/plugins/dhcp/test/test_dhcp.py
+++ b/src/plugins/dhcp/test/test_dhcp.py
@@ -1297,12 +1297,6 @@
         self.assertTrue(find_route(self, self.pg3.local_ip4, 24))
         self.assertTrue(find_route(self, self.pg3.local_ip4, 32))
 
-        # remove the left over ARP entry
-        self.vapi.ip_neighbor_add_del(self.pg3.sw_if_index,
-                                      self.pg3.remote_mac,
-                                      self.pg3.remote_ip4,
-                                      is_add=0)
-
         #
         # remove the DHCP config
         #
diff --git a/src/plugins/gbp/gbp_endpoint.c b/src/plugins/gbp/gbp_endpoint.c
index c6cab3f..9ef0890 100644
--- a/src/plugins/gbp/gbp_endpoint.c
+++ b/src/plugins/gbp/gbp_endpoint.c
@@ -24,13 +24,12 @@
 #include <plugins/gbp/gbp_policy_dpo.h>
 #include <plugins/gbp/gbp_vxlan.h>
 
-#include <vnet/ethernet/arp.h>
 #include <vnet/l2/l2_input.h>
 #include <vnet/l2/l2_output.h>
 #include <vnet/l2/feat_bitmap.h>
 #include <vnet/l2/l2_fib.h>
 #include <vnet/fib/fib_table.h>
-#include <vnet/ip/ip_neighbor.h>
+#include <vnet/ip-neighbor/ip_neighbor.h>
 #include <vnet/fib/fib_walk.h>
 #include <vnet/vxlan-gbp/vxlan_gbp.h>
 
@@ -208,12 +207,6 @@
   return (ge - gbp_endpoint_pool);
 }
 
-static ip46_type_t
-ip46_address_get_type (const ip46_address_t * a)
-{
-  return (ip46_address_is_ip4 (a) ? IP46_TYPE_IP4 : IP46_TYPE_IP6);
-}
-
 static int
 gbp_endpoint_ip_is_equal (const fib_prefix_t * fp, const ip46_address_t * ip)
 {
@@ -775,14 +768,11 @@
 	  {
 	    gbp_endpoint_add_itf (gbp_itf_get_sw_if_index (gef->gef_itf),
 				  gei);
-	    if (FIB_PROTOCOL_IP4 == pfx->fp_proto)
-	      send_ip4_garp_w_addr (vlib_get_main (),
-				    &pfx->fp_addr.ip4,
-				    gg->gg_uplink_sw_if_index);
-	    else
-	      send_ip6_na_w_addr (vlib_get_main (),
-				  &pfx->fp_addr.ip6,
-				  gg->gg_uplink_sw_if_index);
+	    ip_neighbor_advertise (vlib_get_main (),
+				   (FIB_PROTOCOL_IP4 == pfx->fp_proto ?
+				    IP46_TYPE_IP4 :
+				    IP46_TYPE_IP6),
+				   &pfx->fp_addr, gg->gg_uplink_sw_if_index);
 	  }
       }
   }
diff --git a/src/plugins/gbp/gbp_route_domain.c b/src/plugins/gbp/gbp_route_domain.c
index f0aa694..99c6e16 100644
--- a/src/plugins/gbp/gbp_route_domain.c
+++ b/src/plugins/gbp/gbp_route_domain.c
@@ -18,7 +18,6 @@
 
 #include <vnet/dpo/dvr_dpo.h>
 #include <vnet/fib/fib_table.h>
-#include <vnet/ip/ip_neighbor.h>
 
 /**
  * A fixed MAC address to use as the source MAC for packets L3 switched
diff --git a/src/plugins/l3xc/test/test_l3xc.py b/src/plugins/l3xc/test/test_l3xc.py
index add27e7..d7a8297 100644
--- a/src/plugins/l3xc/test/test_l3xc.py
+++ b/src/plugins/l3xc/test/test_l3xc.py
@@ -87,7 +87,6 @@
         for i in self.pg_interfaces:
             i.unconfig_ip4()
             i.unconfig_ip6()
-            i.ip6_disable()
             i.admin_down()
         super(TestL3xc, self).tearDown()
 
diff --git a/src/plugins/mactime/builtins.c b/src/plugins/mactime/builtins.c
index 906164e..e90ac66 100644
--- a/src/plugins/mactime/builtins.c
+++ b/src/plugins/mactime/builtins.c
@@ -3,6 +3,17 @@
 #include <http_static/http_static.h>
 #include <mactime/mactime.h>
 #include <vlib/unix/plugin.h>
+#include <vnet/ip-neighbor/ip_neighbor.h>
+
+static walk_rc_t
+mactime_ip_neighbor_copy (index_t ipni, void *ctx)
+{
+  mactime_main_t *mm = ctx;
+
+  vec_add1 (mm->arp_cache_copy, ipni);
+
+  return (WALK_CONTINUE);
+}
 
 static int
 handle_get_mactime (http_builtin_method_type_t reqtype,
@@ -17,17 +28,14 @@
   int i, j;
   f64 now;
   vlib_counter_t allow, drop;
-  ethernet_arp_ip4_entry_t *n, *pool;
+  ip_neighbor_t *n;
   char *q = "\"";
   u8 *s = 0;
   int need_comma = 0;
 
+  /* Walk all ip4 neighbours on all interfaces */
   vec_reset_length (mm->arp_cache_copy);
-  pool = ip4_neighbors_pool ();
-
-  /* *INDENT-OFF* */
-  pool_foreach (n, pool, ({ vec_add1 (mm->arp_cache_copy, n[0]);}));
-  /* *INDENT-ON* */
+  ip_neighbor_walk (IP46_TYPE_IP4, ~0, mactime_ip_neighbor_copy, mm);
 
   now = clib_timebase_now (&mm->timebase);
 
@@ -124,11 +132,13 @@
 
       for (j = 0; j < vec_len (mm->arp_cache_copy); j++)
 	{
-	  n = mm->arp_cache_copy + j;
-	  if (!memcmp (dp->mac_address, n->mac.bytes, sizeof (n->mac)))
+	  n = ip_neighbor_get (mm->arp_cache_copy[j]);
+	  if (!memcmp (dp->mac_address,
+		       ip_neighbor_get_mac (n), sizeof (mac_address_t)))
 	    {
 	      s = format (s, ", %sip4_address%s: %s%U%s", q, q,
-			  q, format_ip4_address, &n->ip4_address, q);
+			  q, format_ip46_address,
+			  ip_neighbor_get_ip (n), IP46_TYPE_IP4, q);
 	      break;
 	    }
 	}
diff --git a/src/plugins/mactime/mactime.c b/src/plugins/mactime/mactime.c
index 9192a26..e7dcb03 100644
--- a/src/plugins/mactime/mactime.c
+++ b/src/plugins/mactime/mactime.c
@@ -33,6 +33,8 @@
 #define REPLY_MSG_ID_BASE mm->msg_id_base
 #include <vlibapi/api_helper_macros.h>
 
+#include <vnet/ip-neighbor/ip_neighbor.h>
+
 mactime_main_t mactime_main;
 
 /** \file time-base src-mac filter device-input feature arc implementation
@@ -425,7 +427,12 @@
   return 0;
 }
 
-VLIB_INIT_FUNCTION (mactime_init);
+/* *INDENT-OFF* */
+VLIB_INIT_FUNCTION (mactime_init) =
+{
+  .runs_after = VLIB_INITS("ip_neighbor_init"),
+};
+/* *INDENT-ON* */
 
 static clib_error_t *
 mactime_config (vlib_main_t * vm, unformat_input_t * input)
@@ -519,6 +526,16 @@
   return s;
 }
 
+static walk_rc_t
+mactime_ip_neighbor_copy (index_t ipni, void *ctx)
+{
+  mactime_main_t *mm = ctx;
+
+  vec_add1 (mm->arp_cache_copy, ipni);
+
+  return (WALK_CONTINUE);
+}
+
 static clib_error_t *
 show_mactime_command_fn (vlib_main_t * vm,
 			 unformat_input_t * input, vlib_cli_command_t * cmd)
@@ -533,17 +550,11 @@
   int i, j;
   f64 now;
   vlib_counter_t allow, drop;
-  ethernet_arp_ip4_entry_t *n, *pool;
+  ip_neighbor_t *ipn;
 
   vec_reset_length (mm->arp_cache_copy);
-  pool = ip4_neighbors_pool ();
-
-  /* *INDENT-OFF* */
-  pool_foreach (n, pool,
-  ({
-    vec_add1 (mm->arp_cache_copy, n[0]);
-  }));
-  /* *INDENT-ON* */
+  /* Walk all ip4 neighbours on all interfaces */
+  ip_neighbor_walk (IP46_TYPE_IP4, ~0, mactime_ip_neighbor_copy, mm);
 
   now = clib_timebase_now (&mm->timebase);
 
@@ -660,11 +671,12 @@
       /* This is really only good for small N... */
       for (j = 0; j < vec_len (mm->arp_cache_copy); j++)
 	{
-	  n = mm->arp_cache_copy + j;
-	  if (!memcmp (dp->mac_address, n->mac.bytes, sizeof (n->mac)))
+	  ipn = ip_neighbor_get (mm->arp_cache_copy[j]);
+	  if (!memcmp
+	      (dp->mac_address, ipn->ipn_mac.bytes, sizeof (ipn->ipn_mac)))
 	    {
-	      vlib_cli_output (vm, "%17s%U", " ", format_ip4_address,
-			       &n->ip4_address);
+	      vlib_cli_output (vm, "%17s%U", " ", format_ip46_address,
+			       ip_neighbor_get_ip (ipn), IP46_TYPE_IP4);
 	    }
 	}
     }
diff --git a/src/plugins/mactime/mactime.h b/src/plugins/mactime/mactime.h
index 61160f8..b6313ea 100644
--- a/src/plugins/mactime/mactime.h
+++ b/src/plugins/mactime/mactime.h
@@ -21,7 +21,7 @@
 #include <vnet/vnet.h>
 #include <vnet/ip/ip.h>
 #include <vnet/ethernet/ethernet.h>
-#include <vnet/ethernet/arp.h>
+//#include <vnet/ethernet/arp.h>
 #include <vlib/counter.h>
 
 #include <vppinfra/hash.h>
@@ -71,7 +71,7 @@
   int feature_initialized;
 
   /* arp cache copy, for "show mactime" */
-  ethernet_arp_ip4_entry_t *arp_cache_copy;
+  index_t *arp_cache_copy;
 
   /* convenience */
   vlib_main_t *vlib_main;
diff --git a/src/plugins/mactime/test/test_mactime.py b/src/plugins/mactime/test/test_mactime.py
index eb28002..fa9516c 100644
--- a/src/plugins/mactime/test/test_mactime.py
+++ b/src/plugins/mactime/test/test_mactime.py
@@ -44,7 +44,7 @@
                 "bin mactime_enable_disable sw_if_index 1",
                 "set interface state loop0 up",
                 "clear mactime",
-                "set ip arp loop0 192.168.1.1 00:d0:2d:5e:86:85",
+                "set ip neighbor loop0 192.168.1.1 00:d0:2d:5e:86:85",
                 "bin mactime_add_del_range name sallow "
                 "mac 00:d0:2d:5e:86:85 allow-static del",
                 "bin mactime_add_del_range name sallow "
diff --git a/src/plugins/nat/nat64_in2out.c b/src/plugins/nat/nat64_in2out.c
index 225683c..8d1d734 100644
--- a/src/plugins/nat/nat64_in2out.c
+++ b/src/plugins/nat/nat64_in2out.c
@@ -453,13 +453,13 @@
   ip46_address_t saddr, daddr;
   nat64_db_t *db = &nm->db[ctx->thread_index];
 
-  if (ip46_address_is_equal (&ste->in_r_addr, &ctx->dst_addr))
+  if (ip6_address_is_equal (&ste->in_r_addr, &ctx->dst_addr))
     {
       bibe = nat64_db_bib_entry_by_index (db, ste->proto, ste->bibe_index);
       if (!bibe)
 	return -1;
 
-      if (ip46_address_is_equal (&bibe->in_addr, &ctx->src_addr)
+      if (ip6_address_is_equal (&bibe->in_addr, &ctx->src_addr)
 	  && bibe->fib_index == ctx->fib_index)
 	{
 	  clib_memset (&saddr, 0, sizeof (saddr));
diff --git a/src/plugins/ping/ping.c b/src/plugins/ping/ping.c
index eaf5d29..7045648 100755
--- a/src/plugins/ping/ping.c
+++ b/src/plugins/ping/ping.c
@@ -19,6 +19,7 @@
 #include <vnet/fib/ip6_fib.h>
 #include <vnet/fib/ip4_fib.h>
 #include <vnet/fib/fib_entry.h>
+#include <vnet/ip/ip6_link.h>
 #include <vnet/plugin/plugin.h>
 #include <vpp/app/version.h>
 
@@ -730,19 +731,16 @@
   int res;
   if (is_ip6)
     {
-      ip6_main_t *im = &ip6_main;
       ip6_header_t *ip6 = vlib_buffer_get_current (b0);
-      res =
-	ip6_src_address_for_packet (&im->lookup_main, sw_if_index,
-				    &ip6->dst_address, &ip6->src_address);
+      res = ip6_src_address_for_packet (sw_if_index,
+					&ip6->dst_address, &ip6->src_address);
     }
   else
     {
       ip4_main_t *im = &ip4_main;
       ip4_header_t *ip4 = vlib_buffer_get_current (b0);
-      res =
-	ip4_src_address_for_packet (&im->lookup_main, sw_if_index,
-				    &ip4->src_address);
+      res = ip4_src_address_for_packet (&im->lookup_main,
+					sw_if_index, &ip4->src_address);
       /* IP4 and IP6 paths have the inverse logic. Harmonize. */
       res = !res;
     }
diff --git a/src/plugins/srv6-ad/test/test_srv6_ad.py b/src/plugins/srv6-ad/test/test_srv6_ad.py
index 55f3da0..828cb74 100644
--- a/src/plugins/srv6-ad/test/test_srv6_ad.py
+++ b/src/plugins/srv6-ad/test/test_srv6_ad.py
@@ -115,7 +115,7 @@
         if any(ipv6):
             self.logger.debug(self.vapi.cli("show ip6 neighbors"))
         if any(ipv4):
-            self.logger.debug(self.vapi.cli("show ip arp"))
+            self.logger.debug(self.vapi.cli("show ip4 neighbors"))
         self.logger.debug(self.vapi.cli("show interface"))
         self.logger.debug(self.vapi.cli("show hardware"))
 
diff --git a/src/plugins/srv6-am/test/test_srv6.py b/src/plugins/srv6-am/test/test_srv6.py
index ac880f1..b1a2d8d 100644
--- a/src/plugins/srv6-am/test/test_srv6.py
+++ b/src/plugins/srv6-am/test/test_srv6.py
@@ -114,7 +114,7 @@
         if any(ipv6):
             self.logger.debug(self.vapi.cli("show ip6 neighbors"))
         if any(ipv4):
-            self.logger.debug(self.vapi.cli("show ip arp"))
+            self.logger.debug(self.vapi.cli("show ip4 neighbors"))
         self.logger.debug(self.vapi.cli("show interface"))
         self.logger.debug(self.vapi.cli("show hardware"))
 
diff --git a/src/plugins/srv6-as/test/test_srv6_as.py b/src/plugins/srv6-as/test/test_srv6_as.py
index 9c4f3e2..9e8e425 100755
--- a/src/plugins/srv6-as/test/test_srv6_as.py
+++ b/src/plugins/srv6-as/test/test_srv6_as.py
@@ -114,7 +114,7 @@
         if any(ipv6):
             self.logger.debug(self.vapi.cli("show ip6 neighbors"))
         if any(ipv4):
-            self.logger.debug(self.vapi.cli("show ip arp"))
+            self.logger.debug(self.vapi.cli("show ip4 neighbors"))
         self.logger.debug(self.vapi.cli("show interface"))
         self.logger.debug(self.vapi.cli("show hardware"))
 
diff --git a/src/plugins/svs/test/test_svs.py b/src/plugins/svs/test/test_svs.py
index ec98637..3daf7a5 100644
--- a/src/plugins/svs/test/test_svs.py
+++ b/src/plugins/svs/test/test_svs.py
@@ -55,7 +55,6 @@
         for i in self.pg_interfaces:
             i.unconfig_ip4()
             i.unconfig_ip6()
-            i.ip6_disable()
             i.set_table_ip4(0)
             i.set_table_ip6(0)
             i.admin_down()