mirror of
https://github.com/openvswitch/ovs
synced 2025-09-02 07:15:17 +00:00
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@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
committed by
Ben Pfaff
parent
74fd3cdb6e
commit
0f28164be0
@@ -866,6 +866,13 @@ netdev_linux_construct_tap(struct netdev *netdev_)
|
|||||||
goto error_close;
|
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;
|
return 0;
|
||||||
|
|
||||||
error_close:
|
error_close:
|
||||||
@@ -885,6 +892,7 @@ netdev_linux_destruct(struct netdev *netdev_)
|
|||||||
if (netdev_get_class(netdev_) == &netdev_tap_class
|
if (netdev_get_class(netdev_) == &netdev_tap_class
|
||||||
&& netdev->tap_fd >= 0)
|
&& netdev->tap_fd >= 0)
|
||||||
{
|
{
|
||||||
|
ioctl(netdev->tap_fd, TUNSETPERSIST, 0);
|
||||||
close(netdev->tap_fd);
|
close(netdev->tap_fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user