IP directed broadcast
[vpp.git] / src / vnet / ip / ip6_neighbor.c
index e281d7e..7c7a706 100644 (file)
@@ -466,6 +466,8 @@ ip6_nbr_probe (ip_adjacency_t * adj)
   h = vlib_packet_template_get_packet (vm,
                                       &im->discover_neighbor_packet_template,
                                       &bi);
+  if (!h)
+    return;
 
   hi = vnet_get_sup_hw_interface (vnm, adj->rewrite_header.sw_if_index);
 
@@ -660,6 +662,14 @@ ip6_ethernet_update_adjacency (vnet_main_t * vnm, u32 sw_if_index, u32 ai)
          ip6_nbr_probe (adj);
        }
       break;
+    case IP_LOOKUP_NEXT_BCAST:
+      adj_nbr_update_rewrite (ai,
+                             ADJ_NBR_REWRITE_FLAG_COMPLETE,
+                             ethernet_build_rewrite (vnm,
+                                                     sw_if_index,
+                                                     VNET_LINK_IP6,
+                                                     VNET_REWRITE_FOR_SW_INTERFACE_ADDRESS_BROADCAST));
+      break;
     case IP_LOOKUP_NEXT_MCAST:
       {
        /*
@@ -792,7 +802,13 @@ vnet_set_ip6_ethernet_neighbor (vlib_main_t * vm,
       n = pool_elt_at_index (nm->neighbor_pool, p[0]);
       /* Refuse to over-write static neighbor entry. */
       if (!is_static && (n->flags & IP6_NEIGHBOR_FLAG_STATIC))
-       return -2;
+       {
+         /* if MAC address match, still check to send event */
+         if (0 == memcmp (n->link_layer_address,
+                          link_layer_address, n_bytes_link_layer_address))
+           goto check_customers;
+         return -2;
+       }
       make_new_nd_cache_entry = 0;
     }
 
@@ -3285,6 +3301,8 @@ ip6_discover_neighbor_inline (vlib_main_t * vm,
 
            h0 = vlib_packet_template_get_packet
              (vm, &im->discover_neighbor_packet_template, &bi0);
+           if (!h0)
+             continue;
 
            /*
             * Build ethernet header.
@@ -4186,6 +4204,7 @@ enable_ip6_interface (vlib_main_t * vm, u32 sw_if_index)
 
                  sw_if0 = vnet_get_sw_interface (vnm, sw_if_index);
                  if (sw_if0->type == VNET_SW_INTERFACE_TYPE_SUB ||
+                     sw_if0->type == VNET_SW_INTERFACE_TYPE_PIPE ||
                      sw_if0->type == VNET_SW_INTERFACE_TYPE_P2P)
                    {
                      /* make up  an interface id */
@@ -5037,6 +5056,9 @@ send_ip6_na_w_addr (vlib_main_t * vm,
        vlib_packet_template_get_packet (vm,
                                         &i6m->discover_neighbor_packet_template,
                                         &bi);
+      if (!h)
+       return;
+
       ip6_set_reserved_multicast_address (&h->ip.dst_address,
                                          IP6_MULTICAST_SCOPE_link_local,
                                          IP6_MULTICAST_GROUP_ID_all_hosts);