summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhenning <henning@openbsd.org>2005-06-08 07:36:50 +0000
committerhenning <henning@openbsd.org>2005-06-08 07:36:50 +0000
commitab89aae3e7124c6f4244279f9cf113b880b01d5e (patch)
treed9a27d2ff58a5ebecdb05dd29534fbcefcd4755e
parentnetns bits die (diff)
downloadwireguard-openbsd-ab89aae3e7124c6f4244279f9cf113b880b01d5e.tar.xz
wireguard-openbsd-ab89aae3e7124c6f4244279f9cf113b880b01d5e.zip
if a cloned interface's destroy function fails, re-join the interface class
group, spotted by and ok markus
-rw-r--r--sys/net/if.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 879a129ef47..8cc996aa18f 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.131 2005/06/08 06:58:11 henning Exp $ */
+/* $OpenBSD: if.c,v 1.132 2005/06/08 07:36:50 henning Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -703,7 +703,7 @@ if_clone_destroy(const char *name)
{
struct if_clone *ifc;
struct ifnet *ifp;
- int s;
+ int s, ret;
ifc = if_clone_lookup(name, NULL);
if (ifc == NULL)
@@ -724,7 +724,10 @@ if_clone_destroy(const char *name)
if_delgroup(ifp, ifc->ifc_name);
- return ((*ifc->ifc_destroy)(ifp));
+ if ((ret = (*ifc->ifc_destroy)(ifp)) == -1)
+ if_addgroup(ifp, ifc->ifc_name);
+
+ return (ret);
}
/*