svn commit: r257033 - user/ae/inet6/sys/netinet6

Andrey V. Elsukov ae at FreeBSD.org
Thu Oct 24 01:02:40 UTC 2013


Author: ae
Date: Thu Oct 24 01:02:39 2013
New Revision: 257033
URL: http://svnweb.freebsd.org/changeset/base/257033

Log:
  Scope releated cleanup in in6_ifattach_linklocal():
  * remove in6_setscope() call;
  * remove in6ifa_ifpforlinklocal() call. It is redundant, since
    in6_update_ifa() returns error.

Modified:
  user/ae/inet6/sys/netinet6/in6_ifattach.c

Modified: user/ae/inet6/sys/netinet6/in6_ifattach.c
==============================================================================
--- user/ae/inet6/sys/netinet6/in6_ifattach.c	Thu Oct 24 00:53:09 2013	(r257032)
+++ user/ae/inet6/sys/netinet6/in6_ifattach.c	Thu Oct 24 01:02:39 2013	(r257033)
@@ -451,7 +451,6 @@ success:
 static int
 in6_ifattach_linklocal(struct ifnet *ifp, struct ifnet *altifp)
 {
-	struct in6_ifaddr *ia;
 	struct in6_aliasreq ifra;
 	struct nd_prefixctl pr0;
 	int i, error;
@@ -470,10 +469,8 @@ in6_ifattach_linklocal(struct ifnet *ifp
 	ifra.ifra_addr.sin6_family = AF_INET6;
 	ifra.ifra_addr.sin6_len = sizeof(struct sockaddr_in6);
 	ifra.ifra_addr.sin6_addr.s6_addr32[0] = htonl(0xfe800000);
-	ifra.ifra_addr.sin6_addr.s6_addr32[1] = 0;
 	if ((ifp->if_flags & IFF_LOOPBACK) != 0) {
-		ifra.ifra_addr.sin6_addr.s6_addr32[2] = 0;
-		ifra.ifra_addr.sin6_addr.s6_addr32[3] = htonl(1);
+		ifra.ifra_addr.sin6_addr.s6_addr32[3] = IPV6_ADDR_INT32_ONE;
 	} else {
 		if (get_ifid(ifp, altifp, &ifra.ifra_addr.sin6_addr) != 0) {
 			nd6log((LOG_ERR,
@@ -481,9 +478,6 @@ in6_ifattach_linklocal(struct ifnet *ifp
 			return (-1);
 		}
 	}
-	if (in6_setscope(&ifra.ifra_addr.sin6_addr, ifp, NULL))
-		return (-1);
-
 	ifra.ifra_prefixmask.sin6_len = sizeof(struct sockaddr_in6);
 	ifra.ifra_prefixmask.sin6_family = AF_INET6;
 	ifra.ifra_prefixmask.sin6_addr = in6mask64;
@@ -512,12 +506,6 @@ in6_ifattach_linklocal(struct ifnet *ifp
 			    if_name(ifp), error));
 		return (-1);
 	}
-
-	ia = in6ifa_ifpforlinklocal(ifp, 0); /* ia must not be NULL */
-	KASSERT(ia != NULL, ("%s: ia == NULL, ifp=%p", __func__, ifp));
-
-	ifa_free(&ia->ia_ifa);
-
 	/*
 	 * Make the link-local prefix (fe80::%link/64) as on-link.
 	 * Since we'd like to manage prefixes separately from addresses,


More information about the svn-src-user mailing list