summaryrefslogtreecommitdiffstats
path: root/src/vat
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-02-18 00:03:54 -0800
committerOle Trøan <otroan@employees.org>2017-03-08 09:47:03 +0000
commit3f844d0bc900e5db40ba74724e2b61e7943682d3 (patch)
tree075cde94bd20f44411922c26c4fbd0cad949545c /src/vat
parent7eaf0e57415615b56904e0054bf0b856db6f9bc1 (diff)
Proxy ND (RFC4389 - or a sub-set thereof). This allows the 'emulation' of bridging. That is hosts in one sub-net reachable via differenet interfaces.
Introducate a new API command: ip6 nd proxy <host-address> <interface> this indicates 2 things; 1) that host <host-address> is reachable out of interface <interface>. VPP will thus install that route. 2) NS requests sent to <host-address> will be responeded to (i.e. proxied). Change-Id: I863f967fdb5097ab3b574769c70afdbfc8d5478a Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vat')
-rw-r--r--src/vat/api_format.c109
1 files changed, 109 insertions, 0 deletions
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, \
"<intfc> | sw_if_index <id> enable | disable") \
_(sw_interface_ip6_set_link_local_address, \
"<intfc> | sw_if_index <id> <ip6-address>/<mask-width>") \
+_(ip6nd_proxy_add_del, \
+ "<intfc> | sw_if_index <id> <ip6-address>") \
+_(ip6nd_proxy_dump, "") \
_(sw_interface_ip6nd_ra_prefix, \
"<intfc> | sw_if_index <id> <ip6-address>/<mask-width>\n" \
"val_life <n> pref_life <n> [def] [noadv] [offl] [noauto]\n" \