summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/tap/tap.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/vnet/devices/tap/tap.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/vnet/devices/tap/tap.c')
-rw-r--r--src/vnet/devices/tap/tap.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c
index a7d10fe5473..e6a7ba518a6 100644
--- a/src/vnet/devices/tap/tap.c
+++ b/src/vnet/devices/tap/tap.c
@@ -292,6 +292,26 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args)
goto error;
}
+ if (args->host_ip4_gw_set)
+ {
+ args->error = vnet_netlink_add_ip4_route (0, 0, &args->host_ip4_gw);
+ if (args->error)
+ {
+ args->rv = VNET_API_ERROR_NETLINK_ERROR;
+ goto error;
+ }
+ }
+
+ if (args->host_ip6_gw_set)
+ {
+ args->error = vnet_netlink_add_ip6_route (0, 0, &args->host_ip6_gw);
+ if (args->error)
+ {
+ args->rv = VNET_API_ERROR_NETLINK_ERROR;
+ goto error;
+ }
+ }
+
/* switch back to old net namespace */
if (args->host_namespace)
{