svn commit: r258834 - user/ae/inet6/sys/netinet6
Andrey V. Elsukov
ae at FreeBSD.org
Mon Dec 2 05:57:10 UTC 2013
Author: ae
Date: Mon Dec 2 05:57:09 2013
New Revision: 258834
URL: http://svnweb.freebsd.org/changeset/base/258834
Log:
Use sa6_checkzone_pcb() function when inpcb is known.
Modified:
user/ae/inet6/sys/netinet6/in6_pcb.c
user/ae/inet6/sys/netinet6/raw_ip6.c
user/ae/inet6/sys/netinet6/scope6.c
user/ae/inet6/sys/netinet6/udp6_usrreq.c
Modified: user/ae/inet6/sys/netinet6/in6_pcb.c
==============================================================================
--- user/ae/inet6/sys/netinet6/in6_pcb.c Mon Dec 2 05:45:11 2013 (r258833)
+++ user/ae/inet6/sys/netinet6/in6_pcb.c Mon Dec 2 05:57:09 2013 (r258834)
@@ -138,7 +138,7 @@ in6_pcbbind(struct inpcb *inp, struct so
if (nam->sa_family != AF_INET6)
return (EAFNOSUPPORT);
/* Check sin6_scope_id. The caller must set it properly. */
- if ((error = sa6_checkzone(sin6)) != 0)
+ if ((error = sa6_checkzone_pcb(inp, sin6)) != 0)
return (error);
if ((error = prison_local_ip6(cred, &sin6->sin6_addr,
@@ -323,7 +323,7 @@ in6_pcbconnect_mbuf(register struct inpc
/*
* Check sin6_scope_id and automatically fill it, if possible.
*/
- error = sa6_checkzone(sin6);
+ error = sa6_checkzone_pcb(inp, sin6);
if (error != 0)
return (error);
if ((error = prison_remote_ip6(inp->inp_cred, &sin6->sin6_addr)) != 0)
Modified: user/ae/inet6/sys/netinet6/raw_ip6.c
==============================================================================
--- user/ae/inet6/sys/netinet6/raw_ip6.c Mon Dec 2 05:45:11 2013 (r258833)
+++ user/ae/inet6/sys/netinet6/raw_ip6.c Mon Dec 2 05:57:09 2013 (r258834)
@@ -734,7 +734,10 @@ rip6_bind(struct socket *so, struct sock
return (error);
if (TAILQ_EMPTY(&V_ifnet) || addr->sin6_family != AF_INET6)
return (EADDRNOTAVAIL);
- if ((error = sa6_checkzone(addr)) != 0)
+ INP_RLOCK(inp);
+ error = sa6_checkzone_pcb(inp, addr);
+ INP_RUNLOCK(inp);
+ if (error != 0)
return (error);
if (!IN6_IS_ADDR_UNSPECIFIED(&addr->sin6_addr)) {
ifa = in6ifa_ifwithaddr(&addr->sin6_addr, addr->sin6_scope_id);
@@ -775,7 +778,9 @@ rip6_connect(struct socket *so, struct s
return (EADDRNOTAVAIL);
if (addr->sin6_family != AF_INET6)
return (EAFNOSUPPORT);
- error = sa6_checkzone(addr);
+ INP_RLOCK(inp);
+ error = sa6_checkzone_pcb(inp, addr);
+ INP_RUNLOCK(inp);
if (error != 0)
return (error);
@@ -873,7 +878,9 @@ rip6_send(struct socket *so, int flags,
* Application must provide a proper zone ID or the use of
* default zone IDs should be enabled.
*/
- ret = sa6_checkzone(dst);
+ INP_RLOCK(inp);
+ ret = sa6_checkzone_pcb(inp, dst);
+ INP_RUNLOCK(inp);
if (ret != 0) {
m_freem(m);
return (ret);
Modified: user/ae/inet6/sys/netinet6/scope6.c
==============================================================================
--- user/ae/inet6/sys/netinet6/scope6.c Mon Dec 2 05:45:11 2013 (r258833)
+++ user/ae/inet6/sys/netinet6/scope6.c Mon Dec 2 05:57:09 2013 (r258834)
@@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$");
#include <net/vnet.h>
#include <netinet/in.h>
-
+#include <netinet/in_pcb.h>
#include <netinet/ip6.h>
#include <netinet6/in6_var.h>
#include <netinet6/ip6_var.h>
Modified: user/ae/inet6/sys/netinet6/udp6_usrreq.c
==============================================================================
--- user/ae/inet6/sys/netinet6/udp6_usrreq.c Mon Dec 2 05:45:11 2013 (r258833)
+++ user/ae/inet6/sys/netinet6/udp6_usrreq.c Mon Dec 2 05:57:09 2013 (r258834)
@@ -1073,6 +1073,7 @@ static int
udp6_send(struct socket *so, int flags, struct mbuf *m,
struct sockaddr *addr, struct mbuf *control, struct thread *td)
{
+ struct sockaddr_in6 tmp;
struct inpcb *inp;
int error = 0;
@@ -1093,7 +1094,9 @@ udp6_send(struct socket *so, int flags,
* Application must provide a proper zone ID or the use of
* default zone IDs should be enabled.
*/
- error = sa6_checkzone((struct sockaddr_in6*)addr);
+ tmp = *(struct sockaddr_in6 *)addr;
+ addr = (struct sockaddr *)&tmp;
+ error = sa6_checkzone_pcb(inp, &tmp);
if (error != 0)
goto bad;
}
More information about the svn-src-user
mailing list