diff options
author | 2010-01-08 19:21:19 +0000 | |
---|---|---|
committer | 2010-01-08 19:21:19 +0000 | |
commit | 86dee754b019ff9ca3223b647b850888707e32c2 (patch) | |
tree | c6169b8b347444df9046101dee4e10215cde46b9 | |
parent | As advertised in the man page, make open(2) return ELOOP (instead (diff) | |
download | wireguard-openbsd-86dee754b019ff9ca3223b647b850888707e32c2.tar.xz wireguard-openbsd-86dee754b019ff9ca3223b647b850888707e32c2.zip |
During "ifconfig $if -inet6" remove v6 addresses even if the
interface is marked down, and wrap interface detach/attach in splnet().
ok henning@ todd@, "I like the idea" deraadt@
-rw-r--r-- | sys/net/if.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index da0b888f45a..c0f3919423b 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.202 2009/12/13 09:41:04 jsing Exp $ */ +/* $OpenBSD: if.c,v 1.203 2010/01/08 19:21:19 stsp Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -1334,14 +1334,21 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) return (error); #ifdef INET6 - /* when IFXF_NOINET6 gets changed, detach/attach */ - if (ifp->if_flags & IFF_UP && ifr->ifr_flags & IFXF_NOINET6 && - !(ifp->if_xflags & IFXF_NOINET6)) + if (ifr->ifr_flags & IFXF_NOINET6 && + !(ifp->if_xflags & IFXF_NOINET6)) { + int s = splnet(); in6_ifdetach(ifp); - if (ifp->if_flags & IFF_UP && ifp->if_xflags & IFXF_NOINET6 && + splx(s); + } + if (ifp->if_xflags & IFXF_NOINET6 && !(ifr->ifr_flags & IFXF_NOINET6)) { ifp->if_xflags &= ~IFXF_NOINET6; - in6_if_up(ifp); + if (ifp->if_flags & IFF_UP) { + /* configure link-local address */ + int s = splnet(); + in6_if_up(ifp); + splx(s); + } } #endif |