diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2010-01-08 19:21:20 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2010-01-08 19:21:20 +0000 |
commit | 8846d57d1a4ac194841c83abd7fded2818af49b8 (patch) | |
tree | 0c697f9a63ba9bef7834f4f90c62f7bb9c915ac3 /sys/net | |
parent | c9fb0097d99bb8f43b938369e14d35cb5253edf5 (diff) |
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@
Diffstat (limited to 'sys/net')
-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 |