Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Oct 2013 00:21:44 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r257026 - user/ae/inet6/sys/netinet6
Message-ID:  <201310240021.r9O0LiZs016061@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Thu Oct 24 00:21:44 2013
New Revision: 257026
URL: http://svnweb.freebsd.org/changeset/base/257026

Log:
  Scope related cleanup in nd6_na_output/nd6_na_input:
  * remove in6_setscope() and in6_clearscope() calls;
  * initialize sin6_scope_id before in6_selectsrc();
  * no need to initialize ro.ro_dst, in6_selectsrc will do it;
  * use IPV6_USEROIF flags for ip6_output().

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

Modified: user/ae/inet6/sys/netinet6/nd6_nbr.c
==============================================================================
--- user/ae/inet6/sys/netinet6/nd6_nbr.c	Thu Oct 24 00:09:17 2013	(r257025)
+++ user/ae/inet6/sys/netinet6/nd6_nbr.c	Thu Oct 24 00:21:44 2013	(r257026)
@@ -646,9 +646,6 @@ nd6_na_input(struct mbuf *m, int off, in
 	is_override = ((flags & ND_NA_FLAG_OVERRIDE) != 0);
 
 	taddr6 = nd_na->nd_na_target;
-	if (in6_setscope(&taddr6, ifp, NULL))
-		goto bad;	/* XXX: impossible */
-
 	if (IN6_IS_ADDR_MULTICAST(&taddr6)) {
 		nd6log((LOG_ERR,
 		    "nd6_na_input: invalid target address %s\n",
@@ -1005,14 +1002,10 @@ nd6_na_output_fib(struct ifnet *ifp, con
 	ip6->ip6_hlim = 255;
 	if (IN6_IS_ADDR_UNSPECIFIED(&daddr6)) {
 		/* reply to DAD */
-		daddr6.s6_addr16[0] = IPV6_ADDR_INT16_MLL;
-		daddr6.s6_addr16[1] = 0;
+		daddr6.s6_addr32[0] = IPV6_ADDR_INT32_MLL;
 		daddr6.s6_addr32[1] = 0;
 		daddr6.s6_addr32[2] = 0;
 		daddr6.s6_addr32[3] = IPV6_ADDR_INT32_ONE;
-		if (in6_setscope(&daddr6, ifp, NULL))
-			goto bad;
-
 		flags &= ~ND_NA_FLAG_SOLICITED;
 	}
 	ip6->ip6_dst = daddr6;
@@ -1020,11 +1013,10 @@ nd6_na_output_fib(struct ifnet *ifp, con
 	dst_sa.sin6_family = AF_INET6;
 	dst_sa.sin6_len = sizeof(struct sockaddr_in6);
 	dst_sa.sin6_addr = daddr6;
-
+	dst_sa.sin6_scope_id = in6_getscopezone(ifp, in6_addrscope(&daddr6));
 	/*
 	 * Select a source whose scope is the same as that of the dest.
 	 */
-	bcopy(&dst_sa, &ro.ro_dst, sizeof(dst_sa));
 	oifp = ifp;
 	error = in6_selectsrc(&dst_sa, NULL, NULL, &ro, NULL, &oifp, &src);
 	if (error) {
@@ -1039,8 +1031,6 @@ nd6_na_output_fib(struct ifnet *ifp, con
 	nd_na->nd_na_type = ND_NEIGHBOR_ADVERT;
 	nd_na->nd_na_code = 0;
 	nd_na->nd_na_target = *taddr6;
-	in6_clearscope(&nd_na->nd_na_target); /* XXX */
-
 	/*
 	 * "tlladdr" indicates NS's condition for adding tlladdr or not.
 	 * see nd6_ns_input() for details.
@@ -1097,7 +1087,7 @@ nd6_na_output_fib(struct ifnet *ifp, con
 		m_tag_prepend(m, mtag);
 	}
 
-	ip6_output(m, NULL, &ro, 0, &im6o, NULL, NULL);
+	ip6_output(m, NULL, &ro, IPV6_USEROIF, &im6o, &ifp, NULL);
 	icmp6_ifstat_inc(ifp, ifs6_out_msg);
 	icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert);
 	ICMP6STAT_INC(icp6s_outhist[ND_NEIGHBOR_ADVERT]);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310240021.r9O0LiZs016061>