summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/in6_pcb.c
diff options
context:
space:
mode:
authorjamie <jamie@FreeBSD.org>2009-02-05 14:25:53 +0000
committerjamie <jamie@FreeBSD.org>2009-02-05 14:25:53 +0000
commitbbcda547da3ebc4ff1d85c6960c8bd2478f200ec (patch)
treee87537d44ef37303106f6142fbf71decf6c088bd /sys/netinet6/in6_pcb.c
parente085cfc4851a368e9eeca99b5977b66c163ff7ee (diff)
downloadFreeBSD-src-bbcda547da3ebc4ff1d85c6960c8bd2478f200ec.zip
FreeBSD-src-bbcda547da3ebc4ff1d85c6960c8bd2478f200ec.tar.gz
Remove redundant calls of prison_local_ip4 in in_pcbbind_setup, and of
prison_local_ip6 in in6_pcbbind. Approved by: bz (mentor)
Diffstat (limited to 'sys/netinet6/in6_pcb.c')
-rw-r--r--sys/netinet6/in6_pcb.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
index 13c55cd..79cb213 100644
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -130,7 +130,11 @@ in6_pcbbind(register struct inpcb *inp, struct sockaddr *nam,
return (EINVAL);
if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT)) == 0)
wild = INPLOOKUP_WILDCARD;
- if (nam) {
+ if (nam == NULL) {
+ if ((error = prison_local_ip6(cred, &inp->in6p_laddr,
+ ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0)
+ return (error);
+ } else {
sin6 = (struct sockaddr_in6 *)nam;
if (nam->sa_len != sizeof(*sin6))
return (EINVAL);
@@ -221,9 +225,6 @@ in6_pcbbind(register struct inpcb *inp, struct sockaddr *nam,
return (EADDRINUSE);
}
}
- if ((error = prison_local_ip6(cred, &sin6->sin6_addr,
- ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0)
- return (error);
t = in6_pcblookup_local(pcbinfo, &sin6->sin6_addr,
lport, wild, cred);
if (t && (reuseport & ((t->inp_vflag & INP_TIMEWAIT) ?
@@ -256,9 +257,6 @@ in6_pcbbind(register struct inpcb *inp, struct sockaddr *nam,
}
inp->in6p_laddr = sin6->sin6_addr;
}
- if ((error = prison_local_ip6(cred, &inp->in6p_laddr,
- ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0)
- return (error);
if (lport == 0) {
if ((error = in6_pcbsetport(&inp->in6p_laddr, inp, cred)) != 0)
return (error);
OpenPOWER on IntegriCloud