summaryrefslogtreecommitdiffstats
path: root/src/vat/api_format.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-01-18 13:35:11 +0100
committerNeale Ranns <nranns@cisco.com>2018-01-18 15:59:06 +0000
commit7866c4595b65f54f491ffc4e92b1f8cf94d6f142 (patch)
tree404c981a49256a66e4a95718f426d2040619fe71 /src/vat/api_format.c
parent929fb9d75071ef4141b1cac3997f86d9ded0a9ab (diff)
tapv2: add option to set host-side default gw
Change-Id: I76fd655ecd9445299b94b3b5af10e7b1588584e4 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vat/api_format.c')
-rw-r--r--src/vat/api_format.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index 3654cd663bd..4f20ea82361 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -7772,8 +7772,12 @@ api_tap_create_v2 (vat_main_t * vam)
u8 host_mac_addr_set = 0;
u8 *host_bridge = 0;
ip4_address_t host_ip4_addr;
+ ip4_address_t host_ip4_gw;
+ u8 host_ip4_gw_set = 0;
u32 host_ip4_prefix_len = 0;
ip6_address_t host_ip6_addr;
+ ip6_address_t host_ip6_gw;
+ u8 host_ip6_gw_set = 0;
u32 host_ip6_prefix_len = 0;
int ret;
int rx_ring_sz = 0, tx_ring_sz = 0;
@@ -7804,6 +7808,12 @@ api_tap_create_v2 (vat_main_t * vam)
else if (unformat (i, "host-ip6-addr %U/%d", unformat_ip6_address,
&host_ip6_addr, &host_ip6_prefix_len))
;
+ else if (unformat (i, "host-ip4-gw %U", unformat_ip4_address,
+ &host_ip4_gw))
+ host_ip4_gw_set = 1;
+ else if (unformat (i, "host-ip6-gw %U", unformat_ip6_address,
+ &host_ip6_gw))
+ host_ip6_gw_set = 1;
else if (unformat (i, "rx-ring-size %d", &rx_ring_sz))
;
else if (unformat (i, "tx-ring-size %d", &tx_ring_sz))
@@ -7885,7 +7895,10 @@ api_tap_create_v2 (vat_main_t * vam)
clib_memcpy (mp->host_ip4_addr, &host_ip4_addr, 4);
if (host_ip4_prefix_len)
clib_memcpy (mp->host_ip6_addr, &host_ip6_addr, 16);
-
+ if (host_ip4_gw_set)
+ clib_memcpy (mp->host_ip4_gw, &host_ip4_gw, 4);
+ if (host_ip6_gw_set)
+ clib_memcpy (mp->host_ip6_gw, &host_ip6_gw, 16);
vec_free (host_ns);
vec_free (host_if_name);