svn commit: r188148 - in head/sys: netinet netinet6
Jamie Gritton
jamie at FreeBSD.org
Thu Feb 5 06:25:54 PST 2009
Author: jamie
Date: Thu Feb 5 14:25:53 2009
New Revision: 188148
URL: http://svn.freebsd.org/changeset/base/188148
Log:
Remove redundant calls of prison_local_ip4 in in_pcbbind_setup, and of
prison_local_ip6 in in6_pcbbind.
Approved by: bz (mentor)
Modified:
head/sys/netinet/in_pcb.c
head/sys/netinet6/in6_pcb.c
Modified: head/sys/netinet/in_pcb.c
==============================================================================
--- head/sys/netinet/in_pcb.c Thu Feb 5 14:21:09 2009 (r188147)
+++ head/sys/netinet/in_pcb.c Thu Feb 5 14:25:53 2009 (r188148)
@@ -313,7 +313,10 @@ in_pcbbind_setup(struct inpcb *inp, stru
return (EINVAL);
if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT)) == 0)
wild = INPLOOKUP_WILDCARD;
- if (nam) {
+ if (nam == NULL) {
+ if ((error = prison_local_ip4(cred, &laddr)) != 0)
+ return (error);
+ } else {
sin = (struct sockaddr_in *)nam;
if (nam->sa_len != sizeof (*sin))
return (EINVAL);
@@ -392,9 +395,6 @@ in_pcbbind_setup(struct inpcb *inp, stru
t->inp_cred->cr_uid))
return (EADDRINUSE);
}
- error = prison_local_ip4(cred, &sin->sin_addr);
- if (error)
- return (error);
t = in_pcblookup_local(pcbinfo, sin->sin_addr,
lport, wild, cred);
if (t && (t->inp_vflag & INP_TIMEWAIT)) {
@@ -428,10 +428,6 @@ in_pcbbind_setup(struct inpcb *inp, stru
u_short first, last, aux;
int count;
- error = prison_local_ip4(cred, &laddr);
- if (error)
- return (error);
-
if (inp->inp_flags & INP_HIGHPORT) {
first = V_ipport_hifirstauto; /* sysctl */
last = V_ipport_hilastauto;
@@ -496,9 +492,6 @@ in_pcbbind_setup(struct inpcb *inp, stru
} while (in_pcblookup_local(pcbinfo, laddr,
lport, wild, cred));
}
- error = prison_local_ip4(cred, &laddr);
- if (error)
- return (error);
*laddrp = laddr.s_addr;
*lportp = lport;
return (0);
Modified: head/sys/netinet6/in6_pcb.c
==============================================================================
--- head/sys/netinet6/in6_pcb.c Thu Feb 5 14:21:09 2009 (r188147)
+++ head/sys/netinet6/in6_pcb.c Thu Feb 5 14:25:53 2009 (r188148)
@@ -130,7 +130,11 @@ in6_pcbbind(register struct inpcb *inp,
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,
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,
}
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);
More information about the svn-src-all
mailing list