svn commit: r256738 - user/ae/inet6/sys/netinet6
Andrey V. Elsukov
ae at FreeBSD.org
Fri Oct 18 13:02:09 UTC 2013
Author: ae
Date: Fri Oct 18 13:02:09 2013
New Revision: 256738
URL: http://svnweb.freebsd.org/changeset/base/256738
Log:
Scope related cleanup in in6_control():
* remove sa6_embedscope(), sa6_recoverscope() and in6_setscope() calls;
* use sa6_checkzone() to check sockaddr_in6 structure. Before this check
initialize sin6_scope_id if it is zero. We can do this, because we know
interface and can use ifnet to determine zone id.
Modified:
user/ae/inet6/sys/netinet6/in6.c
Modified: user/ae/inet6/sys/netinet6/in6.c
==============================================================================
--- user/ae/inet6/sys/netinet6/in6.c Fri Oct 18 12:51:28 2013 (r256737)
+++ user/ae/inet6/sys/netinet6/in6.c Fri Oct 18 13:02:09 2013 (r256738)
@@ -454,10 +454,10 @@ in6_control(struct socket *so, u_long cm
break;
}
if (sa6 && sa6->sin6_family == AF_INET6) {
- if (sa6->sin6_scope_id != 0)
- error = sa6_embedscope(sa6, 0);
- else
- error = in6_setscope(&sa6->sin6_addr, ifp, NULL);
+ if (sa6->sin6_scope_id == 0)
+ sa6->sin6_scope_id = in6_getscopezone(ifp,
+ in6_addrscope(&sa6->sin6_addr));
+ error = sa6_checkzone(sa6);
if (error != 0)
return (error);
if (td != NULL && (error = prison_check_ip6(td->td_ucred,
@@ -557,8 +557,6 @@ in6_control(struct socket *so, u_long cm
switch (cmd) {
case SIOCGIFADDR_IN6:
ifr->ifr_addr = ia->ia_addr;
- if ((error = sa6_recoverscope(&ifr->ifr_addr)) != 0)
- goto out;
break;
case SIOCGIFDSTADDR_IN6:
@@ -571,8 +569,6 @@ in6_control(struct socket *so, u_long cm
* an error?
*/
ifr->ifr_dstaddr = ia->ia_dstaddr;
- if ((error = sa6_recoverscope(&ifr->ifr_dstaddr)) != 0)
- goto out;
break;
case SIOCGIFNETMASK_IN6:
@@ -1818,26 +1814,11 @@ in6_lifaddr_ioctl(struct socket *so, u_l
ia = ifa2ia6(ifa);
if (cmd == SIOCGLIFADDR) {
- int error;
-
/* fill in the if_laddrreq structure */
bcopy(&ia->ia_addr, &iflr->addr, ia->ia_addr.sin6_len);
- error = sa6_recoverscope(
- (struct sockaddr_in6 *)&iflr->addr);
- if (error != 0) {
- ifa_free(ifa);
- return (error);
- }
-
if ((ifp->if_flags & IFF_POINTOPOINT) != 0) {
bcopy(&ia->ia_dstaddr, &iflr->dstaddr,
ia->ia_dstaddr.sin6_len);
- error = sa6_recoverscope(
- (struct sockaddr_in6 *)&iflr->dstaddr);
- if (error != 0) {
- ifa_free(ifa);
- return (error);
- }
} else
bzero(&iflr->dstaddr, sizeof(iflr->dstaddr));
More information about the svn-src-user
mailing list