summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1996-05-14 19:37:34 +0000
committerderaadt <deraadt@openbsd.org>1996-05-14 19:37:34 +0000
commit601292b654670a9a501aa738d2d2af637bcf2072 (patch)
tree3e713dcd601ff21f92297b3c9c42c8f85d74ac85
parentwhen making distributions, make sure the include directory gets filled (diff)
downloadwireguard-openbsd-601292b654670a9a501aa738d2d2af637bcf2072.tar.xz
wireguard-openbsd-601292b654670a9a501aa738d2d2af637bcf2072.zip
non-root bind() to 2049 gets EADDRINUSE
-rw-r--r--sys/netinet/in_pcb.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 8f5cc701afa..90a6392fba7 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.c,v 1.3 1996/03/14 07:58:29 tholo Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.4 1996/05/14 19:37:34 deraadt Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@@ -155,6 +155,14 @@ in_pcbbind(v, nam)
if (ntohs(lport) < IPPORT_RESERVED &&
(error = suser(p->p_ucred, &p->p_acflag)))
return (EACCES);
+ /*
+ * treat port 2049 as a reserved port, but indicate
+ * that it is used to not confuse a bindresvport()
+ * type function
+ */
+ if (ntohs(lport) == 2049 &&
+ suser(p->p_ucred, &p->p_acflag))
+ return (EADDRINUSE);
t = in_pcblookup(table, zeroin_addr, 0,
sin->sin_addr, lport, wild);
if (t && (reuseport & t->inp_socket->so_options) == 0)
@@ -516,7 +524,7 @@ in_pcblookup(table, faddr, fport_arg, laddr, lport_arg, flags)
continue;
} else {
if (faddr.s_addr != INADDR_ANY)
- wildcard++;
+ wildcard++;
}
if (inp->inp_laddr.s_addr != INADDR_ANY) {
if (laddr.s_addr == INADDR_ANY)