diff options
author | John Lo <loj@cisco.com> | 2019-01-07 15:16:33 -0500 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2019-01-07 21:55:28 +0000 |
commit | e26c81fc80d1ce9a8746ebf4009149849b04f60f (patch) | |
tree | 12157a3247ed9169951e1083f8b50e240eec30c7 /src/vnet/l2/l2_api.c | |
parent | 2500c79423c7d8d35b4e7b8f50060c09f2f857be (diff) |
L2 BD API to flush all IP-MAC entries in the specified BD
Implement API/CLI to clear IP-MAC tables used for ARP-termination
in the specified bridge domain.
The CLI to flush MAC IP tables for a BD is:
set bridge-domain arp entry <bd-id> del-all
The API added is bd_ip_mac_flush.
Change-Id: I34ceb87c0f480c7102f6559312c24081ed485af8
Signed-off-by: John Lo <loj@cisco.com>
Diffstat (limited to 'src/vnet/l2/l2_api.c')
-rw-r--r-- | src/vnet/l2/l2_api.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/vnet/l2/l2_api.c b/src/vnet/l2/l2_api.c index 25f38a6d5b0..059f668d664 100644 --- a/src/vnet/l2/l2_api.c +++ b/src/vnet/l2/l2_api.c @@ -66,6 +66,7 @@ _(SW_INTERFACE_SET_L2_BRIDGE, sw_interface_set_l2_bridge) \ _(L2_PATCH_ADD_DEL, l2_patch_add_del) \ _(L2_INTERFACE_EFP_FILTER, l2_interface_efp_filter) \ _(BD_IP_MAC_ADD_DEL, bd_ip_mac_add_del) \ +_(BD_IP_MAC_FLUSH, bd_ip_mac_flush) \ _(BD_IP_MAC_DUMP, bd_ip_mac_dump) \ _(BRIDGE_DOMAIN_ADD_DEL, bridge_domain_add_del) \ _(BRIDGE_DOMAIN_DUMP, bridge_domain_dump) \ @@ -893,6 +894,37 @@ out: REPLY_MACRO (VL_API_BD_IP_MAC_ADD_DEL_REPLY); } +static void +vl_api_bd_ip_mac_flush_t_handler (vl_api_bd_ip_mac_flush_t * mp) +{ + vl_api_bd_ip_mac_flush_reply_t *rmp; + bd_main_t *bdm = &bd_main; + u32 bd_index, bd_id; + int rv = 0; + uword *p; + + bd_id = ntohl (mp->bd_id); + + if (bd_id == 0) + { + rv = VNET_API_ERROR_BD_NOT_MODIFIABLE; + goto out; + } + + p = hash_get (bdm->bd_index_by_bd_id, bd_id); + if (p == 0) + { + rv = VNET_API_ERROR_NO_SUCH_ENTRY; + goto out; + } + bd_index = p[0]; + + bd_flush_ip_mac (bd_index); + +out: + REPLY_MACRO (VL_API_BD_IP_MAC_FLUSH_REPLY); +} + extern void l2_efp_filter_configure (vnet_main_t * vnet_main, u32 sw_if_index, u8 enable); |