X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvat%2Fapi_format.c;h=8b56f7693ebf507ef7a9e9685c1cea1383abe257;hb=4d5b917b1a74461abaa30182d4bf5c7761572323;hp=efd116dd7a77142350e9bfece6e549537a978897;hpb=b7b929931a07fbb27b43d5cd105f366c3e29807e;p=vpp.git diff --git a/src/vat/api_format.c b/src/vat/api_format.c index efd116dd7a7..8b56f7693eb 100644 --- a/src/vat/api_format.c +++ b/src/vat/api_format.c @@ -18,6 +18,7 @@ */ #include +#include #include #include #include @@ -53,6 +54,8 @@ #include #include #include "vat/json_format.h" +#include +#include #include #include @@ -79,6 +82,14 @@ #if VPP_API_TEST_BUILTIN == 0 #include +/* *INDENT-OFF* */ +const mac_address_t ZERO_MAC_ADDRESS = { + .bytes = { + 0, 0, 0, 0, 0, 0, + }, +}; +/* *INDENT-ON* */ + u32 vl (void *p) { @@ -7815,16 +7826,17 @@ api_bridge_flags (vat_main_t * vam) static int api_bd_ip_mac_add_del (vat_main_t * vam) { + vl_api_address_t ip = VL_API_ZERO_ADDRESS; + vl_api_mac_address_t mac = VL_API_ZERO_MAC_ADDRESS; unformat_input_t *i = vam->input; vl_api_bd_ip_mac_add_del_t *mp; + ip46_type_t type; u32 bd_id; u8 is_ipv6 = 0; u8 is_add = 1; u8 bd_id_set = 0; u8 ip_set = 0; u8 mac_set = 0; - ip4_address_t v4addr; - ip6_address_t v6addr; u8 macaddr[6]; int ret; @@ -7836,16 +7848,11 @@ api_bd_ip_mac_add_del (vat_main_t * vam) { bd_id_set++; } - else if (unformat (i, "%U", unformat_ip4_address, &v4addr)) - { - ip_set++; - } - else if (unformat (i, "%U", unformat_ip6_address, &v6addr)) + else if (unformat (i, "%U", unformat_vl_api_address, &ip)) { ip_set++; - is_ipv6++; } - else if (unformat (i, "%U", unformat_ethernet_address, macaddr)) + else if (unformat (i, "%U", unformat_vl_api_mac_address, &mac)) { mac_set++; } @@ -7874,13 +7881,11 @@ api_bd_ip_mac_add_del (vat_main_t * vam) M (BD_IP_MAC_ADD_DEL, mp); mp->bd_id = ntohl (bd_id); - mp->is_ipv6 = is_ipv6; mp->is_add = is_add; - if (is_ipv6) - clib_memcpy (mp->ip_address, &v6addr, sizeof (v6addr)); - else - clib_memcpy (mp->ip_address, &v4addr, sizeof (v4addr)); - clib_memcpy (mp->mac_address, macaddr, 6); + + clib_memcpy (&mp->ip, &ip, sizeof (ip)); + clib_memcpy (&mp->mac, &mac, sizeof (mac)); + S (mp); W (ret); return ret;