diff options
author | jamie <jamie@FreeBSD.org> | 2009-02-05 14:25:53 +0000 |
---|---|---|
committer | jamie <jamie@FreeBSD.org> | 2009-02-05 14:25:53 +0000 |
commit | bbcda547da3ebc4ff1d85c6960c8bd2478f200ec (patch) | |
tree | e87537d44ef37303106f6142fbf71decf6c088bd /sys/netinet/in_pcb.c | |
parent | e085cfc4851a368e9eeca99b5977b66c163ff7ee (diff) | |
download | FreeBSD-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/netinet/in_pcb.c')
-rw-r--r-- | sys/netinet/in_pcb.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 25494cf..3014bc3 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -313,7 +313,10 @@ in_pcbbind_setup(struct inpcb *inp, struct sockaddr *nam, in_addr_t *laddrp, 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, struct sockaddr *nam, in_addr_t *laddrp, 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, struct sockaddr *nam, in_addr_t *laddrp, 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, struct sockaddr *nam, in_addr_t *laddrp, } 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); |