summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/ip')
-rw-r--r--src/vnet/ip/ip6.h5
-rw-r--r--src/vnet/ip/ip6_neighbor.c26
2 files changed, 17 insertions, 14 deletions
diff --git a/src/vnet/ip/ip6.h b/src/vnet/ip/ip6.h
index 4b24774c277..6f6724b3903 100644
--- a/src/vnet/ip/ip6.h
+++ b/src/vnet/ip/ip6.h
@@ -407,10 +407,9 @@ int vnet_ip6_nd_term (vlib_main_t * vm,
ethernet_header_t * eth,
ip6_header_t * ip, u32 sw_if_index, u16 bd_index);
-void send_ip6_na (vlib_main_t * vm, const vnet_hw_interface_t * hi);
+void send_ip6_na (vlib_main_t * vm, u32 sw_if_index);
void send_ip6_na_w_addr (vlib_main_t * vm,
- const ip6_address_t * addr,
- const vnet_hw_interface_t * hi);
+ const ip6_address_t * addr, u32 sw_if_index);
u8 *format_ip6_forward_next_trace (u8 * s, va_list * args);
diff --git a/src/vnet/ip/ip6_neighbor.c b/src/vnet/ip/ip6_neighbor.c
index 1b37e549e83..3daea6bafbe 100644
--- a/src/vnet/ip/ip6_neighbor.c
+++ b/src/vnet/ip/ip6_neighbor.c
@@ -4980,22 +4980,23 @@ ethernet_ndp_change_mac (u32 sw_if_index)
}
void
-send_ip6_na (vlib_main_t * vm, const vnet_hw_interface_t * hi)
+send_ip6_na (vlib_main_t * vm, u32 sw_if_index)
{
ip6_main_t *i6m = &ip6_main;
- u32 sw_if_index = hi->sw_if_index;
ip6_address_t *ip6_addr = ip6_interface_first_address (i6m, sw_if_index);
- send_ip6_na_w_addr (vm, ip6_addr, hi);
+ send_ip6_na_w_addr (vm, ip6_addr, sw_if_index);
}
void
send_ip6_na_w_addr (vlib_main_t * vm,
- const ip6_address_t * ip6_addr,
- const vnet_hw_interface_t * hi)
+ const ip6_address_t * ip6_addr, u32 sw_if_index)
{
ip6_main_t *i6m = &ip6_main;
- u32 sw_if_index = hi->sw_if_index;
+ vnet_main_t *vnm = vnet_get_main ();
+ u8 *rewrite, rewrite_len;
+ vnet_hw_interface_t *hi = vnet_get_sup_hw_interface (vnm, sw_if_index);
+ u8 dst_address[6];
if (ip6_addr)
{
@@ -5026,12 +5027,15 @@ send_ip6_na_w_addr (vlib_main_t * vm,
/* Setup MAC header with IP6 Etype and mcast DMAC */
vlib_buffer_t *b = vlib_get_buffer (vm, bi);
- vlib_buffer_advance (b, -sizeof (ethernet_header_t));
- ethernet_header_t *e = vlib_buffer_get_current (b);
- e->type = clib_host_to_net_u16 (ETHERNET_TYPE_IP6);
- clib_memcpy (e->src_address, hi->hw_address, sizeof (e->src_address));
- ip6_multicast_ethernet_address (e->dst_address,
+ ip6_multicast_ethernet_address (dst_address,
IP6_MULTICAST_GROUP_ID_all_hosts);
+ rewrite =
+ ethernet_build_rewrite (vnm, sw_if_index, VNET_LINK_IP6, dst_address);
+ rewrite_len = vec_len (rewrite);
+ vlib_buffer_advance (b, -rewrite_len);
+ ethernet_header_t *e = vlib_buffer_get_current (b);
+ clib_memcpy (e->dst_address, rewrite, rewrite_len);
+ vec_free (rewrite);
/* Send unsolicited ND advertisement packet out the specified interface */
vnet_buffer (b)->sw_if_index[VLIB_RX] =