Revert "Allow interface types to override glean adjacency behaivour"
[vpp.git] / src / vnet / ethernet / arp.c
index 2f3aa6c..149f0a5 100644 (file)
@@ -94,6 +94,7 @@ typedef struct
   ethernet_proxy_arp_t *proxy_arps;
 
   uword wc_ip4_arp_publisher_node;
+  uword wc_ip4_arp_publisher_et;
 } ethernet_arp_main_t;
 
 static ethernet_arp_main_t ethernet_arp_main;
@@ -202,7 +203,7 @@ format_ethernet_arp_header (u8 * s, va_list * va)
 {
   ethernet_arp_header_t *a = va_arg (*va, ethernet_arp_header_t *);
   u32 max_header_bytes = va_arg (*va, u32);
-  uword indent;
+  u32 indent;
   u16 l2_type, l3_type;
 
   if (max_header_bytes != 0 && sizeof (a[0]) > max_header_bytes)
@@ -614,7 +615,7 @@ vnet_arp_set_ip4_over_ethernet_internal (vnet_main_t * vnm,
        */
       if (0 == memcmp (e->ethernet_address,
                       a->ethernet, sizeof (e->ethernet_address)))
-       return -1;
+       goto check_customers;
 
       /* Update time stamp and ethernet address. */
       clib_memcpy (e->ethernet_address, a->ethernet,
@@ -629,6 +630,7 @@ vnet_arp_set_ip4_over_ethernet_internal (vnet_main_t * vnm,
 
   adj_nbr_walk_nh4 (sw_if_index, &e->ip4_address, arp_mk_complete_walk, e);
 
+check_customers:
   /* Customer(s) waiting for this address to be resolved? */
   p = hash_get (am->pending_resolutions_by_address, a->ip4.as_u32);
   if (p)
@@ -1121,6 +1123,12 @@ arp_input (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
                                  &arp0->ip4_over_ethernet[0]);
              goto drop1;
            }
+         else if (arp0->opcode ==
+                  clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_request) &&
+                  (dst_is_local0 == 0))
+           {
+             goto drop1;
+           }
 
        send_reply:
          /* Send a reply.
@@ -1536,21 +1544,24 @@ vnet_arp_wc_publish_internal (vnet_main_t * vnm,
 {
   vlib_main_t *vm = vlib_get_main ();
   ethernet_arp_main_t *am = &ethernet_arp_main;
-  if (am->wc_ip4_arp_publisher_node == (uword) ~ 0)
+  uword ni = am->wc_ip4_arp_publisher_node;
+  uword et = am->wc_ip4_arp_publisher_et;
+
+  if (ni == (uword) ~ 0)
     return;
   wc_arp_report_t *r =
-    vlib_process_signal_event_data (vm, am->wc_ip4_arp_publisher_node, 1, 1,
-                                   sizeof *r);
+    vlib_process_signal_event_data (vm, ni, et, 1, sizeof *r);
   r->ip4 = args->a.ip4.as_u32;
   r->sw_if_index = args->sw_if_index;
   memcpy (r->mac, args->a.ethernet, sizeof r->mac);
 }
 
 void
-wc_arp_set_publisher_node (uword node_index)
+wc_arp_set_publisher_node (uword node_index, uword event_type)
 {
   ethernet_arp_main_t *am = &ethernet_arp_main;
   am->wc_ip4_arp_publisher_node = node_index;
+  am->wc_ip4_arp_publisher_et = event_type;
 }
 
 /*
@@ -2478,7 +2489,7 @@ ethernet_arp_change_mac (u32 sw_if_index)
   /* *INDENT-ON* */
 }
 
-void static
+void
 send_ip4_garp (vlib_main_t * vm, vnet_hw_interface_t * hi)
 {
   ip4_main_t *i4m = &ip4_main;
@@ -2522,42 +2533,6 @@ send_ip4_garp (vlib_main_t * vm, vnet_hw_interface_t * hi)
     }
 }
 
-static vlib_node_registration_t send_garp_na_proc_node;
-
-static uword
-send_garp_na_process (vlib_main_t * vm,
-                     vlib_node_runtime_t * rt, vlib_frame_t * f)
-{
-  vnet_main_t *vnm = vnet_get_main ();
-  uword event_type, *event_data = 0;
-
-  send_garp_na_process_node_index = send_garp_na_proc_node.index;
-
-  while (1)
-    {
-      vlib_process_wait_for_event (vm);
-      event_type = vlib_process_get_events (vm, &event_data);
-      if ((event_type == SEND_GARP_NA) && (vec_len (event_data) >= 1))
-       {
-         u32 hw_if_index = event_data[0];
-         vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, hw_if_index);
-         send_ip4_garp (vm, hi);
-         send_ip6_na (vm, hi);
-       }
-      vec_reset_length (event_data);
-    }
-  return 0;
-}
-
-
-/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (send_garp_na_proc_node, static) = {
-    .function = send_garp_na_process,
-    .type = VLIB_NODE_TYPE_PROCESS,
-    .name = "send-garp-na-process",
-};
-/* *INDENT-ON* */
-
 /*
  * fd.io coding-style-patch-verification: ON
  *