X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=vnet%2Fvnet%2Fethernet%2Farp.c;h=7d6184381c9516b03da01914ff1be939a582a0a2;hb=c631f2de6dd06b4cbb92bf8398839b882344fd25;hp=d08764a329f26414a823bce237743adf19feda28;hpb=0bfe5d8c792abcdbcf27bfcc7b7b353fba04aee2;p=vpp.git diff --git a/vnet/vnet/ethernet/arp.c b/vnet/vnet/ethernet/arp.c index d08764a329f..7d6184381c9 100644 --- a/vnet/vnet/ethernet/arp.c +++ b/vnet/vnet/ethernet/arp.c @@ -1088,12 +1088,13 @@ arp_input (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) /* * Rewind buffer, direct code above not to * think too hard about it. - * $$$ is the answer ever anything other than - * vlib_buffer_reset(..)? */ if_addr0 = &proxy_src; is_unnum0 = 0; - vlib_buffer_reset (p0); + i32 ethernet_start = + vnet_buffer (p0)->ethernet.start_of_ethernet_header; + i32 rewind = p0->current_data - ethernet_start; + vlib_buffer_advance (p0, -rewind); n_proxy_arp_replies_sent++; goto send_reply; } @@ -2342,6 +2343,43 @@ arp_term_init (vlib_main_t * vm) VLIB_INIT_FUNCTION (arp_term_init); +void +change_arp_mac (u32 sw_if_index, ethernet_arp_ip4_entry_t * e) +{ + if (e->sw_if_index == sw_if_index) + { + + if (ADJ_INDEX_INVALID != e->adj_index[FIB_LINK_IP4]) + { + // the update rewrite function takes the dst mac (which is not changing) + // the new source mac will be retrieved from the interface + // when the full rewrite is constructed. + adj_nbr_update_rewrite (e->adj_index[FIB_LINK_IP4], + e->ethernet_address); + } + if (ADJ_INDEX_INVALID != e->adj_index[FIB_LINK_MPLS]) + { + adj_nbr_update_rewrite (e->adj_index[FIB_LINK_MPLS], + e->ethernet_address); + } + + } +} + +void +ethernet_arp_change_mac (vnet_main_t * vnm, u32 sw_if_index) +{ + ethernet_arp_main_t *am = ðernet_arp_main; + ethernet_arp_ip4_entry_t *e; + + /* *INDENT-OFF* */ + pool_foreach (e, am->ip4_entry_pool, + ({ + change_arp_mac (sw_if_index, e); + })); + /* *INDENT-ON* */ +} + /* * fd.io coding-style-patch-verification: ON *