diff options
Diffstat (limited to 'src/vat')
-rw-r--r-- | src/vat/api_format.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c index 4c1a85f58e6..9f02507e4f7 100644 --- a/src/vat/api_format.c +++ b/src/vat/api_format.c @@ -5173,6 +5173,7 @@ _(l2_interface_pbb_tag_rewrite_reply) \ _(set_punt_reply) \ _(feature_enable_disable_reply) \ _(sw_interface_tag_add_del_reply) \ +_(sw_interface_add_del_mac_address_reply) \ _(hw_interface_set_mtu_reply) \ _(p2p_ethernet_add_reply) \ _(p2p_ethernet_del_reply) \ @@ -5481,6 +5482,7 @@ _(IP_TABLE_DETAILS, ip_table_details) \ _(IP_ROUTE_DETAILS, ip_route_details) \ _(FEATURE_ENABLE_DISABLE_REPLY, feature_enable_disable_reply) \ _(SW_INTERFACE_TAG_ADD_DEL_REPLY, sw_interface_tag_add_del_reply) \ +_(SW_INTERFACE_ADD_DEL_MAC_ADDRESS_REPLY, sw_interface_add_del_mac_address_reply) \ _(L2_XCONNECT_DETAILS, l2_xconnect_details) \ _(HW_INTERFACE_SET_MTU_REPLY, hw_interface_set_mtu_reply) \ _(IP_NEIGHBOR_DETAILS, ip_neighbor_details) \ @@ -19999,6 +20001,54 @@ api_sw_interface_tag_add_del (vat_main_t * vam) return ret; } +static int +api_sw_interface_add_del_mac_address (vat_main_t * vam) +{ + unformat_input_t *i = vam->input; + vl_api_mac_address_t mac = { 0 }; + vl_api_sw_interface_add_del_mac_address_t *mp; + u32 sw_if_index = ~0; + u8 is_add = 1; + u8 mac_set = 0; + int ret; + + while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) + { + if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index)) + ; + else if (unformat (i, "sw_if_index %d", &sw_if_index)) + ; + else if (unformat (i, "%U", unformat_vl_api_mac_address, &mac)) + mac_set++; + else if (unformat (i, "del")) + is_add = 0; + else + break; + } + + if (sw_if_index == ~0) + { + errmsg ("missing interface name or sw_if_index"); + return -99; + } + + if (!mac_set) + { + errmsg ("missing MAC address"); + return -99; + } + + /* Construct the API message */ + M (SW_INTERFACE_ADD_DEL_MAC_ADDRESS, mp); + mp->sw_if_index = ntohl (sw_if_index); + mp->is_add = is_add; + clib_memcpy (&mp->addr, &mac, sizeof (mac)); + + S (mp); + W (ret); + return ret; +} + static void vl_api_l2_xconnect_details_t_handler (vl_api_l2_xconnect_details_t * mp) { @@ -21753,6 +21803,8 @@ _(feature_enable_disable, "arc_name <arc_name> " \ "feature_name <feature_name> <intfc> | sw_if_index <nn> [disable]") \ _(sw_interface_tag_add_del, "<intfc> | sw_if_index <nn> tag <text>" \ "[disable]") \ +_(sw_interface_add_del_mac_address, "<intfc> | sw_if_index <nn> " \ + "mac <mac-address> [del]") \ _(l2_xconnect_dump, "") \ _(hw_interface_set_mtu, "<intfc> | hw_if_index <nn> mtu <nn>") \ _(ip_neighbor_dump, "[ip6] <intfc> | sw_if_index <nn>") \ |