diff options
author | Neale Ranns <nranns@cisco.com> | 2017-03-08 01:12:54 -0800 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2017-03-08 01:30:17 -0800 |
commit | 5e323329ed6ded6f6944c56069329207ad9069c0 (patch) | |
tree | 885f29ffddfd59df5311f99ec52e8b549698cfc9 | |
parent | 8099e903464b190f990caf200e3de9948d504ed6 (diff) |
ARP resilience in the absence of IP config on input and output interfaces
Change-Id: Ia9c6790436f8f6337b5351e3017ef5e441a8a4e9
Signed-off-by: Neale Ranns <nranns@cisco.com>
-rw-r--r-- | vnet/vnet/ethernet/arp.c | 6 | ||||
-rw-r--r-- | vnet/vnet/ip/ip4.h | 1 | ||||
-rw-r--r-- | vnet/vnet/ip/lookup.c | 15 |
3 files changed, 21 insertions, 1 deletions
diff --git a/vnet/vnet/ethernet/arp.c b/vnet/vnet/ethernet/arp.c index 0298541bb46..25710482d4c 100644 --- a/vnet/vnet/ethernet/arp.c +++ b/vnet/vnet/ethernet/arp.c @@ -750,6 +750,7 @@ typedef enum _ (missing_interface_address, "ARP missing interface address") \ _ (gratuitous_arp, "ARP probe or announcement dropped") \ _ (interface_no_table, "Interface is not mapped to an IP table") \ + _ (interface_not_ip_enabled, "Interface is not IP enabled") \ typedef enum { @@ -1006,6 +1007,11 @@ arp_input (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) sw_if_index0 = vnet_buffer (p0)->sw_if_index[VLIB_RX]; + /* not playing the ARP game if the interface is not IPv4 enabled */ + error0 = + (im4->ip_enabled_by_sw_if_index[sw_if_index0] == 0 ? + ETHERNET_ARP_ERROR_interface_not_ip_enabled : error0); + if (error0) goto drop2; diff --git a/vnet/vnet/ip/ip4.h b/vnet/vnet/ip/ip4.h index 0331c44563e..cc33dff468f 100644 --- a/vnet/vnet/ip/ip4.h +++ b/vnet/vnet/ip/ip4.h @@ -190,7 +190,6 @@ ip4_src_address_for_packet (ip_lookup_main_t * lm, } else { - ASSERT (0); src->as_u32 = 0; } return (!0); diff --git a/vnet/vnet/ip/lookup.c b/vnet/vnet/ip/lookup.c index 734a4cd7cfb..a8a72596053 100644 --- a/vnet/vnet/ip/lookup.c +++ b/vnet/vnet/ip/lookup.c @@ -168,6 +168,21 @@ ip_interface_address_add_del (ip_lookup_main_t * lm, return /* no error */ 0; } +static clib_error_t * +ip_sw_interface_add_del (vnet_main_t * vnm, u32 sw_if_index, u32 is_add) +{ + vec_validate_init_empty (ip4_main. + lookup_main.if_address_pool_index_by_sw_if_index, + sw_if_index, ~0); + vec_validate_init_empty (ip6_main. + lookup_main.if_address_pool_index_by_sw_if_index, + sw_if_index, ~0); + + return (NULL); +} + +VNET_SW_INTERFACE_ADD_DEL_FUNCTION (ip_sw_interface_add_del); + void ip_lookup_init (ip_lookup_main_t * lm, u32 is_ip6) { |