[ovs-dev] [PATCH 2/3] netdev-linux: make tap devices persistent.
Vishal Deep Ajmera
vishal.deep.ajmera at ericsson.com
Wed Jun 7 09:39:16 UTC 2017
Hi Flavio,
If the tap-device is persistent but the 'netdev' datapath is not yet started then will it create any issues in the system ? What happens if we start sending packets on this interface whereas data-path is not present ?
Regards,
Vishal
-----Original Message-----
From: ovs-dev-bounces at openvswitch.org [mailto:ovs-dev-bounces at openvswitch.org] On Behalf Of Flavio Leitner
Sent: Tuesday, May 30, 2017 1:10 AM
To: dev at openvswitch.org
Cc: Flavio Leitner <fbl at redhat.com>
Subject: [ovs-dev] [PATCH 2/3] netdev-linux: make tap devices persistent.
When using data path type "netdev", bridge port is a tun device and when OVS restarts, that device and its network configuration is lost.
This patch enables the tap device to persist instead.
Signed-off-by: Flavio Leitner <fbl at redhat.com>
---
lib/netdev-linux.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 3ad3d45..d181e4f 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -866,6 +866,13 @@ netdev_linux_construct_tap(struct netdev *netdev_)
goto error_close;
}
+ if (ioctl(netdev->tap_fd, TUNSETPERSIST, 1)) {
+ VLOG_WARN("%s: creating tap device failed (persist): %s", name,
+ ovs_strerror(errno));
+ error = errno;
+ goto error_close;
+ }
+
return 0;
error_close:
@@ -885,6 +892,7 @@ netdev_linux_destruct(struct netdev *netdev_)
if (netdev_get_class(netdev_) == &netdev_tap_class
&& netdev->tap_fd >= 0)
{
+ ioctl(netdev->tap_fd, TUNSETPERSIST, 0);
close(netdev->tap_fd);
}
--
2.9.4
_______________________________________________
dev mailing list
dev at openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev
More information about the dev
mailing list