X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvat%2Fapi_format.c;h=08a2a774fcea95abc4496024c832df2a591c09c3;hb=3f844d0bc900e5db40ba74724e2b61e7943682d3;hp=fb596fe69d0579de6e30593ba16c831a98ff7ae6;hpb=7eaf0e57415615b56904e0054bf0b856db6f9bc1;p=vpp.git diff --git a/src/vat/api_format.c b/src/vat/api_format.c index fb596fe69d0..08a2a774fce 100644 --- a/src/vat/api_format.c +++ b/src/vat/api_format.c @@ -3913,6 +3913,7 @@ _(dhcp_client_config_reply) \ _(set_ip_flow_hash_reply) \ _(sw_interface_ip6_enable_disable_reply) \ _(sw_interface_ip6_set_link_local_address_reply) \ +_(ip6nd_proxy_add_del_reply) \ _(sw_interface_ip6nd_ra_prefix_reply) \ _(sw_interface_ip6nd_ra_config_reply) \ _(set_arp_neighbor_limit_reply) \ @@ -4092,6 +4093,8 @@ _(SW_INTERFACE_IP6_ENABLE_DISABLE_REPLY, \ sw_interface_ip6_enable_disable_reply) \ _(SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS_REPLY, \ sw_interface_ip6_set_link_local_address_reply) \ +_(IP6ND_PROXY_ADD_DEL_REPLY, ip6nd_proxy_add_del_reply) \ +_(IP6ND_PROXY_DETAILS, ip6nd_proxy_details) \ _(SW_INTERFACE_IP6ND_RA_PREFIX_REPLY, \ sw_interface_ip6nd_ra_prefix_reply) \ _(SW_INTERFACE_IP6ND_RA_CONFIG_REPLY, \ @@ -7968,6 +7971,109 @@ api_sw_interface_ip6_set_link_local_address (vat_main_t * vam) return ret; } +static int +api_ip6nd_proxy_add_del (vat_main_t * vam) +{ + unformat_input_t *i = vam->input; + vl_api_ip6nd_proxy_add_del_t *mp; + u32 sw_if_index = ~0; + u8 v6_address_set = 0; + ip6_address_t v6address; + u8 is_del = 0; + int ret; + + /* Parse args required to build the message */ + 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_ip6_address, &v6address)) + v6_address_set = 1; + if (unformat (i, "del")) + is_del = 1; + else + { + clib_warning ("parse error '%U'", format_unformat_error, i); + return -99; + } + } + + if (sw_if_index == ~0) + { + errmsg ("missing interface name or sw_if_index"); + return -99; + } + if (!v6_address_set) + { + errmsg ("no address set"); + return -99; + } + + /* Construct the API message */ + M (IP6ND_PROXY_ADD_DEL, mp); + + mp->is_del = is_del; + mp->sw_if_index = ntohl (sw_if_index); + clib_memcpy (mp->address, &v6address, sizeof (v6address)); + + /* send it... */ + S (mp); + + /* Wait for a reply, return good/bad news */ + W (ret); + return ret; +} + +static int +api_ip6nd_proxy_dump (vat_main_t * vam) +{ + vl_api_ip6nd_proxy_dump_t *mp; + vl_api_control_ping_t *mp_ping; + int ret; + + M (IP6ND_PROXY_DUMP, mp); + + S (mp); + + /* Use a control ping for synchronization */ + M (CONTROL_PING, mp_ping); + S (mp_ping); + + W (ret); + return ret; +} + +static void vl_api_ip6nd_proxy_details_t_handler + (vl_api_ip6nd_proxy_details_t * mp) +{ + vat_main_t *vam = &vat_main; + + print (vam->ofp, "host %U sw_if_index %d", + format_ip6_address, mp->address, ntohl (mp->sw_if_index)); +} + +static void vl_api_ip6nd_proxy_details_t_handler_json + (vl_api_ip6nd_proxy_details_t * mp) +{ + vat_main_t *vam = &vat_main; + struct in6_addr ip6; + vat_json_node_t *node = NULL; + + if (VAT_JSON_ARRAY != vam->json_tree.type) + { + ASSERT (VAT_JSON_NONE == vam->json_tree.type); + vat_json_init_array (&vam->json_tree); + } + node = vat_json_array_add (&vam->json_tree); + + vat_json_init_object (node); + vat_json_object_add_uint (node, "sw_if_index", ntohl (mp->sw_if_index)); + + clib_memcpy (&ip6, mp->address, sizeof (ip6)); + vat_json_object_add_ip6 (node, "host", ip6); +} static int api_sw_interface_ip6nd_ra_prefix (vat_main_t * vam) @@ -17974,6 +18080,9 @@ _(sw_interface_ip6_enable_disable, \ " | sw_if_index enable | disable") \ _(sw_interface_ip6_set_link_local_address, \ " | sw_if_index /") \ +_(ip6nd_proxy_add_del, \ + " | sw_if_index ") \ +_(ip6nd_proxy_dump, "") \ _(sw_interface_ip6nd_ra_prefix, \ " | sw_if_index /\n" \ "val_life pref_life [def] [noadv] [offl] [noauto]\n" \