Attention is currently required from: Antonio Quartulli, Arne Schwabe, Răzvan
Cojocaru.
Hello Arne Schwabe, Răzvan Cojocaru,
I'd like you to reexamine a change. Please visit
https://gerrit.openvpn.net/c/openvpn/+/1897?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Code-Review-1 by Răzvan Cojocaru
Change subject: dco_freebsd: close DCO fds when closing the tun device
......................................................................
dco_freebsd: close DCO fds when closing the tun device
On FreeBSD close_tun_dco() is never called: its only call site lives in
the Linux close_tun(), behind a TARGET_FREEBSD guard that can never be
true there. As a result the DCO control socket and notification pipe
leak every time the tun device is closed (e.g. on restart without
--persist-tun).
Call close_tun_dco() from the FreeBSD close_tun() as well. Since that
function already destroys the interface via "ifconfig destroy" (and
keeps it when persistent_if is set), reduce close_tun_dco() to closing
the fds and drop the now unused remove_interface().
While at it, remove the dead TARGET_FREEBSD guard from the Linux
close_tun().
Change-Id: I10326c787cd8149e7617279e45166073d66b9101
Signed-off-by: Antonio Quartulli <[email protected]>
---
M src/openvpn/dco_freebsd.c
M src/openvpn/tun.c
2 files changed, 6 insertions(+), 23 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/97/1897/2
diff --git a/src/openvpn/dco_freebsd.c b/src/openvpn/dco_freebsd.c
index d933aaf..78b8daa 100644
--- a/src/openvpn/dco_freebsd.c
+++ b/src/openvpn/dco_freebsd.c
@@ -306,26 +306,6 @@
return 0;
}
-static int
-remove_interface(struct tuntap *tt)
-{
- int ret;
- struct ifreq ifr;
-
- CLEAR(ifr);
- snprintf(ifr.ifr_name, IFNAMSIZ, "%s", tt->dco.ifname);
-
- ret = ioctl(tt->dco.fd, SIOCIFDESTROY, &ifr);
- if (ret)
- {
- msg(M_ERR, "Failed to remove interface %s", ifr.ifr_name);
- }
-
- tt->dco.ifname[0] = 0;
-
- return ret;
-}
-
int
open_tun_dco(struct tuntap *tt, openvpn_net_ctx_t *ctx, const char *dev)
{
@@ -348,7 +328,7 @@
void
close_tun_dco(struct tuntap *tt, openvpn_net_ctx_t *ctx)
{
- remove_interface(tt);
+ /* the interface itself is destroyed by close_tun() via ifconfig */
close_fd(&tt->dco);
}
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index af48921..b793556 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -2240,12 +2240,10 @@
{
ASSERT(tt);
-#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
if (tun_dco_enabled(tt))
{
close_tun_dco(tt, ctx);
}
-#endif
close_tun_generic(tt);
free(tt);
}
@@ -2825,6 +2823,11 @@
{
ASSERT(tt);
+ if (tun_dco_enabled(tt))
+ {
+ close_tun_dco(tt, ctx);
+ }
+
if (tt->persistent_if) /* keep pre-existing if around */
{
close_tun_generic(tt);
--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/1897?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I10326c787cd8149e7617279e45166073d66b9101
Gerrit-Change-Number: 1897
Gerrit-PatchSet: 2
Gerrit-Owner: Antonio Quartulli <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-Reviewer: Răzvan Cojocaru <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Antonio Quartulli <[email protected]>
Gerrit-Attention: Răzvan Cojocaru <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel