X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fethernet%2Farp.c;h=6b1069ecb6dc6a91ea04c775b82b7071de6c4f94;hb=9db6ada779794779158163f6293b479ae7f6ad5e;hp=c7e27ffbae75e36c2749c160c9145aac90c5b942;hpb=fe2fff37bbe215f092a452e8322de7f885fc0298;p=vpp.git diff --git a/src/vnet/ethernet/arp.c b/src/vnet/ethernet/arp.c index c7e27ffbae7..6b1069ecb6d 100644 --- a/src/vnet/ethernet/arp.c +++ b/src/vnet/ethernet/arp.c @@ -264,7 +264,6 @@ format_ethernet_arp_ip4_entry (u8 * s, va_list * va) vnet_main_t *vnm = va_arg (*va, vnet_main_t *); ethernet_arp_ip4_entry_t *e = va_arg (*va, ethernet_arp_ip4_entry_t *); vnet_sw_interface_t *si; - u8 *flags = 0; if (!e) return format (s, "%=12s%=16s%=6s%=20s%=24s", "Time", "IP4", @@ -272,24 +271,12 @@ format_ethernet_arp_ip4_entry (u8 * s, va_list * va) si = vnet_get_sw_interface (vnm, e->sw_if_index); - if (e->flags & IP_NEIGHBOR_FLAG_STATIC) - flags = format (flags, "S"); - - if (e->flags & IP_NEIGHBOR_FLAG_DYNAMIC) - flags = format (flags, "D"); - - if (e->flags & IP_NEIGHBOR_FLAG_NO_FIB_ENTRY) - flags = format (flags, "N"); - - s = format (s, "%=12U%=16U%=6s%=20U%U", - format_vlib_time, vnm->vlib_main, e->time_last_updated, - format_ip4_address, &e->ip4_address, - flags ? (char *) flags : "", - format_mac_address_t, &e->mac, - format_vnet_sw_interface_name, vnm, si); - - vec_free (flags); - return s; + return format (s, "%=12U%=16U%=6U%=20U%U", + format_vlib_time, vnm->vlib_main, e->time_last_updated, + format_ip4_address, &e->ip4_address, + format_ip_neighbor_flags, e->flags, + format_mac_address_t, &e->mac, + format_vnet_sw_interface_name, vnm, si); } typedef struct @@ -473,6 +460,8 @@ arp_enable (ethernet_arp_main_t * am, u32 sw_if_index) am->ethernet_arp_by_sw_if_index[sw_if_index].enabled = 1; vnet_feature_enable_disable ("arp", "arp-reply", sw_if_index, 1, NULL, 0); + vnet_feature_enable_disable ("arp", "arp-disabled", sw_if_index, 0, NULL, + 0); } static int @@ -491,6 +480,8 @@ arp_disable (ethernet_arp_main_t * am, u32 sw_if_index) if (!arp_is_enabled (am, sw_if_index)) return; + vnet_feature_enable_disable ("arp", "arp-disabled", sw_if_index, 1, NULL, + 0); vnet_feature_enable_disable ("arp", "arp-reply", sw_if_index, 0, NULL, 0); eai = &am->ethernet_arp_by_sw_if_index[sw_if_index]; @@ -1720,7 +1711,7 @@ VNET_FEATURE_ARC_INIT (arp_feat, static) = { .arc_name = "arp", .start_nodes = VNET_FEATURES ("arp-input"), - .last_in_arc = "arp-disabled", + .last_in_arc = "error-drop", .arc_index_ptr = ðernet_arp_main.feature_arc_index, }; @@ -1739,10 +1730,17 @@ VNET_FEATURE_INIT (arp_proxy_feat_node, static) = .runs_before = VNET_FEATURES ("arp-disabled"), }; -VNET_FEATURE_INIT (arp_drop_feat_node, static) = +VNET_FEATURE_INIT (arp_disabled_feat_node, static) = { .arc_name = "arp", .node_name = "arp-disabled", + .runs_before = VNET_FEATURES ("error-drop"), +}; + +VNET_FEATURE_INIT (arp_drop_feat_node, static) = +{ + .arc_name = "arp", + .node_name = "error-drop", .runs_before = 0, /* last feature */ }; @@ -2478,41 +2476,6 @@ proxy_arp_intfc_walk (proxy_arp_intf_walk_t cb, void *data) } } -/* - * Remove any proxy arp entries associated with the - * specified fib. - */ -int -vnet_proxy_arp_fib_reset (u32 fib_id) -{ - ethernet_arp_main_t *am = ðernet_arp_main; - ethernet_proxy_arp_t *pa; - u32 *entries_to_delete = 0; - u32 fib_index; - int i; - - fib_index = fib_table_find (FIB_PROTOCOL_IP4, fib_id); - if (~0 == fib_index) - return VNET_API_ERROR_NO_SUCH_ENTRY; - - vec_foreach (pa, am->proxy_arps) - { - if (pa->fib_index == fib_index) - { - vec_add1 (entries_to_delete, pa - am->proxy_arps); - } - } - - for (i = 0; i < vec_len (entries_to_delete); i++) - { - vec_delete (am->proxy_arps, 1, entries_to_delete[i]); - } - - vec_free (entries_to_delete); - - return 0; -} - static clib_error_t * ip_arp_add_del_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) @@ -3061,9 +3024,10 @@ send_ip4_garp_w_addr (vlib_main_t * vm, static clib_error_t * vnet_arp_delete_sw_interface (vnet_main_t * vnm, u32 sw_if_index, u32 is_add) { + ethernet_arp_main_t *am = ðernet_arp_main; + if (!is_add && sw_if_index != ~0) { - ethernet_arp_main_t *am = ðernet_arp_main; ethernet_arp_ip4_entry_t *e; /* *INDENT-OFF* */ pool_foreach (e, am->ip4_entry_pool, ({ @@ -3076,6 +3040,12 @@ vnet_arp_delete_sw_interface (vnet_main_t * vnm, u32 sw_if_index, u32 is_add) vnet_arp_unset_ip4_over_ethernet_internal (vnm, &args); })); /* *INDENT-ON* */ + arp_disable (am, sw_if_index); + } + else if (is_add) + { + vnet_feature_enable_disable ("arp", "arp-disabled", + sw_if_index, 1, NULL, 0); } return (NULL);