From owner-svn-src-all@FreeBSD.ORG Sun Oct 16 19:46:53 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DE5A106566B; Sun, 16 Oct 2011 19:46:53 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 142A58FC12; Sun, 16 Oct 2011 19:46:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9GJkqGT077137; Sun, 16 Oct 2011 19:46:52 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9GJkqeP077135; Sun, 16 Oct 2011 19:46:52 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201110161946.p9GJkqeP077135@svn.freebsd.org> From: Hiroki Sato Date: Sun, 16 Oct 2011 19:46:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226446 - head/sys/netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2011 19:46:53 -0000 Author: hrs Date: Sun Oct 16 19:46:52 2011 New Revision: 226446 URL: http://svn.freebsd.org/changeset/base/226446 Log: Fix a problem that an interface unexpectedly becomes IFF_UP by just doing "ifconfing inet6 -ifdisabled" when the interface has ND6_IFF_AUTO_LINKLOCAL flag and no link-local address. Modified: head/sys/netinet6/nd6.c Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Sun Oct 16 19:23:43 2011 (r226445) +++ head/sys/netinet6/nd6.c Sun Oct 16 19:46:52 2011 (r226446) @@ -1364,7 +1364,8 @@ nd6_ioctl(u_long cmd, caddr_t data, stru " duplicate.\n"); } else { ND_IFINFO(ifp)->flags &= ~ND6_IFF_IFDISABLED; - in6_if_up(ifp); + if (ifp->if_flags & IFF_UP) + in6_if_up(ifp); } } else if (!(ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) && (ND.flags & ND6_IFF_IFDISABLED)) { @@ -1382,35 +1383,37 @@ nd6_ioctl(u_long cmd, caddr_t data, stru IF_ADDR_UNLOCK(ifp); } - if (!(ND_IFINFO(ifp)->flags & ND6_IFF_AUTO_LINKLOCAL) && - (ND.flags & ND6_IFF_AUTO_LINKLOCAL)) { - /* auto_linklocal 0->1 transision */ - - /* If no link-local address on ifp, configure */ - ND_IFINFO(ifp)->flags |= ND6_IFF_AUTO_LINKLOCAL; - in6_ifattach(ifp, NULL); - } else if ((ND_IFINFO(ifp)->flags & ND6_IFF_AUTO_LINKLOCAL) && - !(ND.flags & ND6_IFF_IFDISABLED)) { - /* - * When the IF already has - * ND6_IFF_AUTO_LINKLOCAL and no link-local - * address is assigned, try to assign one. - */ - int haslinklocal = 0; + if (ND.flags & ND6_IFF_AUTO_LINKLOCAL) { + if (!(ND_IFINFO(ifp)->flags & ND6_IFF_AUTO_LINKLOCAL)) { + /* auto_linklocal 0->1 transision */ + + /* If no link-local address on ifp, configure */ + ND_IFINFO(ifp)->flags |= ND6_IFF_AUTO_LINKLOCAL; + in6_ifattach(ifp, NULL); + } else if (!(ND.flags & ND6_IFF_IFDISABLED) && + ifp->if_flags & IFF_UP) { + /* + * When the IF already has + * ND6_IFF_AUTO_LINKLOCAL, no link-local + * address is assigned, and IFF_UP, try to + * assign one. + */ + int haslinklocal = 0; - IF_ADDR_LOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - if (ifa->ifa_addr->sa_family != AF_INET6) - continue; - ia = (struct in6_ifaddr *)ifa; - if (IN6_IS_ADDR_LINKLOCAL(IA6_IN6(ia))) { - haslinklocal = 1; - break; + IF_ADDR_LOCK(ifp); + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + if (ifa->ifa_addr->sa_family != AF_INET6) + continue; + ia = (struct in6_ifaddr *)ifa; + if (IN6_IS_ADDR_LINKLOCAL(IA6_IN6(ia))) { + haslinklocal = 1; + break; + } } + IF_ADDR_UNLOCK(ifp); + if (!haslinklocal) + in6_ifattach(ifp, NULL); } - IF_ADDR_UNLOCK(ifp); - if (!haslinklocal) - in6_ifattach(ifp, NULL); } } ND_IFINFO(ifp)->flags = ND.flags;