diff options
author | Dave Barach <dbarach@cisco.com> | 2017-08-15 19:03:44 -0400 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2017-08-17 17:24:25 +0000 |
commit | 3bbcfab119483ef07543242df2c4bb9b4c82b9ac (patch) | |
tree | 3b504ec5ef955df9b145153bf9359d6447494c6f /src/vat/api_format.c | |
parent | f413bef1358e014c9a6cb75bd2ec3e1f351e64ff (diff) |
TCP source address automation
- v6 support
- Non-default VRF ID collection
- Break up ip source address list into CLI + API-friendly functions
- Automate proxy arp / proxy nd configuration
- Automate local adjacency insertion
- Binary API support
Change-Id: Iede31184f65cc1ec8c414447d2d60a1334e3fe15
Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vat/api_format.c')
-rw-r--r-- | src/vat/api_format.c | 76 |
1 files changed, 73 insertions, 3 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c index 9381ec5df45..43d1eb3d3b4 100644 --- a/src/vat/api_format.c +++ b/src/vat/api_format.c @@ -4733,7 +4733,8 @@ _(sw_interface_set_mtu_reply) \ _(p2p_ethernet_add_reply) \ _(p2p_ethernet_del_reply) \ _(lldp_config_reply) \ -_(sw_interface_set_lldp_reply) +_(sw_interface_set_lldp_reply) \ +_(tcp_configure_src_addresses_reply) #define _(n) \ static void vl_api_##n##_t_handler \ @@ -5027,7 +5028,8 @@ _(SW_INTERFACE_GET_TABLE_REPLY, sw_interface_get_table_reply) \ _(P2P_ETHERNET_ADD_REPLY, p2p_ethernet_add_reply) \ _(P2P_ETHERNET_DEL_REPLY, p2p_ethernet_del_reply) \ _(LLDP_CONFIG_REPLY, lldp_config_reply) \ -_(SW_INTERFACE_SET_LLDP_REPLY, sw_interface_set_lldp_reply) +_(SW_INTERFACE_SET_LLDP_REPLY, sw_interface_set_lldp_reply) \ +_(TCP_CONFIGURE_SRC_ADDRESSES_REPLY, tcp_configure_src_addresses_reply) #define foreach_standalone_reply_msg \ _(SW_INTERFACE_EVENT, sw_interface_event) \ @@ -19695,6 +19697,73 @@ api_sw_interface_set_lldp (vat_main_t * vam) } static int +api_tcp_configure_src_addresses (vat_main_t * vam) +{ + vl_api_tcp_configure_src_addresses_t *mp; + unformat_input_t *i = vam->input; + ip4_address_t v4first, v4last; + ip6_address_t v6first, v6last; + u8 range_set = 0; + u32 vrf_id = 0; + int ret; + + while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) + { + if (unformat (i, "%U - %U", + unformat_ip4_address, &v4first, + unformat_ip4_address, &v4last)) + { + if (range_set) + { + errmsg ("one range per message (range already set)"); + return -99; + } + range_set = 1; + } + else if (unformat (i, "%U - %U", + unformat_ip6_address, &v6first, + unformat_ip6_address, &v6last)) + { + if (range_set) + { + errmsg ("one range per message (range already set)"); + return -99; + } + range_set = 2; + } + else if (unformat (i, "vrf %d", &vrf_id)) + ; + else + break; + } + + if (range_set == 0) + { + errmsg ("address range not set"); + return -99; + } + + M (TCP_CONFIGURE_SRC_ADDRESSES, mp); + mp->vrf_id = ntohl (vrf_id); + /* ipv6? */ + if (range_set == 2) + { + mp->is_ipv6 = 1; + clib_memcpy (mp->first_address, &v6first, sizeof (v6first)); + clib_memcpy (mp->last_address, &v6last, sizeof (v6last)); + } + else + { + mp->is_ipv6 = 0; + clib_memcpy (mp->first_address, &v4first, sizeof (v4first)); + clib_memcpy (mp->last_address, &v4last, sizeof (v4last)); + } + S (mp); + W (ret); + return ret; +} + +static int q_or_quit (vat_main_t * vam) { #if VPP_API_TEST_BUILTIN == 0 @@ -20467,7 +20536,8 @@ _(sw_interface_get_table, "<intfc> | sw_if_index <id> [ipv6]") \ _(p2p_ethernet_add, "<intfc> | sw_if_index <nn> remote_mac <mac-address> sub_id <id>") \ _(p2p_ethernet_del, "<intfc> | sw_if_index <nn> remote_mac <mac-address>") \ _(lldp_config, "system-name <name> tx-hold <nn> tx-interval <nn>") \ -_(sw_interface_set_lldp, "<intfc> | sw_if_index <nn> [port-desc <description>] [disable]") +_(sw_interface_set_lldp, "<intfc> | sw_if_index <nn> [port-desc <description>] [disable]") \ +_(tcp_configure_src_addresses, "<ip4|6>first-<ip4|6>last [vrf <id>]") /* List of command functions, CLI names map directly to functions */ #define foreach_cli_function \ |