IPv6 MLD; pointer address used as hash key
[vpp.git] / src / vnet / ip / ip6_neighbor.c
index 1908a67..22f640c 100644 (file)
@@ -566,8 +566,10 @@ ip6_ethernet_update_adjacency (vnet_main_t * vnm, u32 sw_if_index, u32 ai)
 
   switch (adj->lookup_next_index)
     {
-    case IP_LOOKUP_NEXT_ARP:
     case IP_LOOKUP_NEXT_GLEAN:
+      adj_glean_update_rewrite (ai);
+      break;
+    case IP_LOOKUP_NEXT_ARP:
       if (NULL != nbr)
        {
          adj_nbr_walk_nh6 (sw_if_index, &nbr->key.ip6_address,
@@ -723,7 +725,7 @@ vnet_set_ip6_ethernet_neighbor (vlib_main_t * vm,
        */
       if (0 == memcmp (n->link_layer_address,
                       link_layer_address, n_bytes_link_layer_address))
-       return -1;
+       goto check_customers;
 
       clib_memcpy (n->link_layer_address,
                   link_layer_address, n_bytes_link_layer_address);
@@ -739,6 +741,7 @@ vnet_set_ip6_ethernet_neighbor (vlib_main_t * vm,
   adj_nbr_walk_nh6 (sw_if_index,
                    &n->key.ip6_address, ip6_nd_mk_complete_walk, n);
 
+check_customers:
   /* Customer(s) waiting for this address to be resolved? */
   p = mhash_get (&nm->pending_resolutions_by_address, a);
   if (p)
@@ -2076,7 +2079,7 @@ ip6_neighbor_add_mld_prefix (ip6_radv_t * radv_info, ip6_address_t * addr)
   uword *p;
 
   /* lookup  mldp info for this interface */
-  p = mhash_get (&radv_info->address_to_mldp_index, &addr);
+  p = mhash_get (&radv_info->address_to_mldp_index, addr);
   mcast_group_info =
     p ? pool_elt_at_index (radv_info->mldp_group_pool, p[0]) : 0;
 
@@ -2088,13 +2091,13 @@ ip6_neighbor_add_mld_prefix (ip6_radv_t * radv_info, ip6_address_t * addr)
       pool_get (radv_info->mldp_group_pool, mcast_group_info);
 
       mi = mcast_group_info - radv_info->mldp_group_pool;
-      mhash_set (&radv_info->address_to_mldp_index, &addr, mi, /* old_value */
+      mhash_set (&radv_info->address_to_mldp_index, addr, mi,  /* old_value */
                 0);
 
       mcast_group_info->type = 4;
       mcast_group_info->mcast_source_address_pool = 0;
       mcast_group_info->num_sources = 0;
-      clib_memcpy (&mcast_group_info->mcast_address, &addr,
+      clib_memcpy (&mcast_group_info->mcast_address, addr,
                   sizeof (ip6_address_t));
     }
 }
@@ -2434,7 +2437,7 @@ VLIB_REGISTER_NODE (ip6_icmp_router_solicitation_node,static) =
 
   .n_next_nodes = ICMP6_ROUTER_SOLICITATION_N_NEXT,
   .next_nodes = {
-    [ICMP6_ROUTER_SOLICITATION_NEXT_DROP] = "error-drop",
+    [ICMP6_ROUTER_SOLICITATION_NEXT_DROP] = "ip6-drop",
     [ICMP6_ROUTER_SOLICITATION_NEXT_REPLY_RW] = "ip6-rewrite-mcast",
     [ICMP6_ROUTER_SOLICITATION_NEXT_REPLY_TX] = "interface-output",
   },
@@ -2627,7 +2630,7 @@ VLIB_REGISTER_NODE (ip6_icmp_router_advertisement_node,static) =
 
   .n_next_nodes = 1,
   .next_nodes = {
-    [0] = "error-drop",
+    [0] = "ip6-drop",
   },
 };
 /* *INDENT-ON* */
@@ -2670,7 +2673,7 @@ VLIB_REGISTER_NODE (ip6_icmp_neighbor_solicitation_node,static) =
 
   .n_next_nodes = ICMP6_NEIGHBOR_SOLICITATION_N_NEXT,
   .next_nodes = {
-    [ICMP6_NEIGHBOR_SOLICITATION_NEXT_DROP] = "error-drop",
+    [ICMP6_NEIGHBOR_SOLICITATION_NEXT_DROP] = "ip6-drop",
     [ICMP6_NEIGHBOR_SOLICITATION_NEXT_REPLY] = "interface-output",
   },
 };
@@ -2688,7 +2691,7 @@ VLIB_REGISTER_NODE (ip6_icmp_neighbor_advertisement_node,static) =
 
   .n_next_nodes = 1,
   .next_nodes = {
-    [0] = "error-drop",
+    [0] = "ip6-drop",
   },
 };
 /* *INDENT-ON* */
@@ -4255,6 +4258,7 @@ ethernet_ndp_change_mac (u32 sw_if_index)
 {
   ip6_neighbor_main_t *nm = &ip6_neighbor_main;
   ip6_neighbor_t *n;
+  adj_index_t ai;
 
   /* *INDENT-OFF* */
   pool_foreach (n, nm->neighbor_pool,
@@ -4267,6 +4271,11 @@ ethernet_ndp_change_mac (u32 sw_if_index)
       }
   }));
   /* *INDENT-ON* */
+
+  ai = adj_glean_get (FIB_PROTOCOL_IP6, sw_if_index);
+
+  if (ADJ_INDEX_INVALID != ai)
+    adj_glean_update_rewrite (ai);
 }
 
 void