tapv2: add option to set host-side default gw
Change-Id: I76fd655ecd9445299b94b3b5af10e7b1588584e4
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c
index a7d10fe..e6a7ba5 100644
--- a/src/vnet/devices/tap/tap.c
+++ b/src/vnet/devices/tap/tap.c
@@ -292,6 +292,26 @@
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)
{