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

Andrey V. Elsukov ae at FreeBSD.org
Tue Jan 22 12:40:01 UTC 2013


Author: ae
Date: Tue Jan 22 12:40:00 2013
New Revision: 245791
URL: http://svnweb.freebsd.org/changeset/base/245791

Log:
  Use sa6_checkzone and in6ifa_ifwithaddr functions in the in6_pcbbind.

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

Modified: user/ae/inet6/sys/netinet6/in6_pcb.c
==============================================================================
--- user/ae/inet6/sys/netinet6/in6_pcb.c	Tue Jan 22 12:34:22 2013	(r245790)
+++ user/ae/inet6/sys/netinet6/in6_pcb.c	Tue Jan 22 12:40:00 2013	(r245791)
@@ -142,8 +142,8 @@ in6_pcbbind(register struct inpcb *inp, 
 		if (nam->sa_family != AF_INET6)
 			return (EAFNOSUPPORT);
 
-		if ((error = sa6_embedscope(sin6, V_ip6_use_defzone)) != 0)
-			return(error);
+		if ((error = sa6_checkzone(sin6)) != 0)
+			return (error);
 
 		if ((error = prison_local_ip6(cred, &sin6->sin6_addr,
 		    ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0)
@@ -161,11 +161,10 @@ in6_pcbbind(register struct inpcb *inp, 
 			if (so->so_options & SO_REUSEADDR)
 				reuseport = SO_REUSEADDR|SO_REUSEPORT;
 		} else if (!IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
-			struct ifaddr *ifa;
+			struct in6_ifaddr *ifa;
 
 			sin6->sin6_port = 0;		/* yech... */
-			if ((ifa = ifa_ifwithaddr((struct sockaddr *)sin6)) ==
-			    NULL &&
+			if ((ifa = in6ifa_ifwithaddr(sin6)) == NULL &&
 			    (inp->inp_flags & INP_BINDANY) == 0) {
 				return (EADDRNOTAVAIL);
 			}
@@ -176,8 +175,7 @@ in6_pcbbind(register struct inpcb *inp, 
 			 * We should allow to bind to a deprecated address, since
 			 * the application dares to use it.
 			 */
-			if (ifa != NULL &&
-			    ((struct in6_ifaddr *)ifa)->ia6_flags &
+			if (ifa != NULL && ifa->ia6_flags &
 			    (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY|IN6_IFF_DETACHED)) {
 				ifa_free(ifa);
 				return (EADDRNOTAVAIL);


More information about the svn-src-user mailing list