summaryrefslogtreecommitdiffstats
path: root/sys/netinet/in_pcb.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-10-30 06:13:10 +0000
committerpeter <peter@FreeBSD.org>1996-10-30 06:13:10 +0000
commit0ddb96bd1e62a8fbdb72a3a0ddaf0584557a132a (patch)
tree216e61a11d86f1c4ab8e8e474c3b75095748ef85 /sys/netinet/in_pcb.c
parent89da5daba54bd5531e14afb288106143061bc3a9 (diff)
downloadFreeBSD-src-0ddb96bd1e62a8fbdb72a3a0ddaf0584557a132a.zip
FreeBSD-src-0ddb96bd1e62a8fbdb72a3a0ddaf0584557a132a.tar.gz
Fix braino on my part. When we have three different port ranges (default,
"high" and "secure"), we can't use a single variable to track the most recently used port in all three ranges.. :-] This caused the next transient port to be allocated from the start of the range more often than it should.
Diffstat (limited to 'sys/netinet/in_pcb.c')
-rw-r--r--sys/netinet/in_pcb.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index ceebbd9..e5da5fc 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)in_pcb.c 8.4 (Berkeley) 5/24/95
- * $Id: in_pcb.c,v 1.21 1996/08/23 18:59:05 phk Exp $
+ * $Id: in_pcb.c,v 1.22 1996/10/07 19:06:07 davidg Exp $
*/
#include <sys/param.h>
@@ -140,7 +140,7 @@ in_pcbbind(inp, nam)
struct mbuf *nam;
{
register struct socket *so = inp->inp_socket;
- unsigned short *lastport = &inp->inp_pcbinfo->lastport;
+ unsigned short *lastport;
struct sockaddr_in *sin;
struct proc *p = curproc; /* XXX */
u_short lport = 0;
@@ -206,14 +206,17 @@ in_pcbbind(inp, nam)
if (inp->inp_flags & INP_HIGHPORT) {
first = ipport_hifirstauto; /* sysctl */
last = ipport_hilastauto;
+ lastport = &inp->inp_pcbinfo->lasthi;
} else if (inp->inp_flags & INP_LOWPORT) {
if (error = suser(p->p_ucred, &p->p_acflag))
return (EACCES);
first = ipport_lowfirstauto; /* 1023 */
last = ipport_lowlastauto; /* 600 */
+ lastport = &inp->inp_pcbinfo->lastlow;
} else {
first = ipport_firstauto; /* sysctl */
last = ipport_lastauto;
+ lastport = &inp->inp_pcbinfo->lastport;
}
/*
* Simple check to ensure all ports are not used up causing
OpenPOWER on IntegriCloud