ip: Protocol Independent IP Neighbors
[vpp.git] / src / plugins / gbp / gbp_endpoint.c
index bef6777..9ef0890 100644 (file)
 #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 @@ gbp_endpoint_index (const gbp_endpoint_t * ge)
   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 @@ gbb_endpoint_fwd_recalc (gbp_endpoint_t * ge)
          {
            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);
          }
       }
   }
@@ -1268,8 +1258,8 @@ gbp_endpoint_show_one (index_t gei, void *ctx)
   return (WALK_CONTINUE);
 }
 
-static void
-gbp_endpoint_walk_ip_itf (const clib_bihash_kv_24_8_t * kvp, void *arg)
+static int
+gbp_endpoint_walk_ip_itf (clib_bihash_kv_24_8_t * kvp, void *arg)
 {
   ip46_address_t ip;
   vlib_main_t *vm;
@@ -1283,10 +1273,11 @@ gbp_endpoint_walk_ip_itf (const clib_bihash_kv_24_8_t * kvp, void *arg)
                   format_ip46_address, &ip, IP46_TYPE_ANY,
                   format_vnet_sw_if_index_name, vnet_get_main (),
                   sw_if_index, kvp->value);
+  return (BIHASH_WALK_CONTINUE);
 }
 
-static void
-gbp_endpoint_walk_mac_itf (const clib_bihash_kv_16_8_t * kvp, void *arg)
+static int
+gbp_endpoint_walk_mac_itf (clib_bihash_kv_16_8_t * kvp, void *arg)
 {
   mac_address_t mac;
   vlib_main_t *vm;
@@ -1300,6 +1291,7 @@ gbp_endpoint_walk_mac_itf (const clib_bihash_kv_16_8_t * kvp, void *arg)
                   format_mac_address_t, &mac,
                   format_vnet_sw_if_index_name, vnet_get_main (),
                   sw_if_index, kvp->value);
+  return (BIHASH_WALK_CONTINUE);
 }
 
 static clib_error_t *