summaryrefslogtreecommitdiffstats
path: root/sys/netinet/in_pcb.c
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2009-06-01 10:30:00 +0000
committerpjd <pjd@FreeBSD.org>2009-06-01 10:30:00 +0000
commit5243d2d206ac372ee679c11bde715a4a4f2f93fd (patch)
treece73855429371a51ef92709203be008be66b6119 /sys/netinet/in_pcb.c
parenteb2d64c1bdd4159506f34e57ff8df73c843b7500 (diff)
downloadFreeBSD-src-5243d2d206ac372ee679c11bde715a4a4f2f93fd.zip
FreeBSD-src-5243d2d206ac372ee679c11bde715a4a4f2f93fd.tar.gz
- Rename IP_NONLOCALOK IP socket option to IP_BINDANY, to be more consistent
with OpenBSD (and BSD/OS originally). We can't easly do it SOL_SOCKET option as there is no more space for more SOL_SOCKET options, but this option also fits better as an IP socket option, it seems. - Implement this functionality also for IPv6 and RAW IP sockets. - Always compile it in (don't use additional kernel options). - Remove sysctl to turn this functionality on and off. - Introduce new privilege - PRIV_NETINET_BINDANY, which allows to use this functionality (currently only unjail root can use it). Discussed with: julian, adrian, jhb, rwatson, kmacy
Diffstat (limited to 'sys/netinet/in_pcb.c')
-rw-r--r--sys/netinet/in_pcb.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index b507fbf..0b4ef27 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -35,7 +35,6 @@
__FBSDID("$FreeBSD$");
#include "opt_ddb.h"
-#include "opt_inet.h"
#include "opt_ipsec.h"
#include "opt_inet6.h"
#include "opt_mac.h"
@@ -357,14 +356,11 @@ in_pcbbind_setup(struct inpcb *inp, struct sockaddr *nam, in_addr_t *laddrp,
bzero(&sin->sin_zero, sizeof(sin->sin_zero));
/*
* Is the address a local IP address?
- * If INP_NONLOCALOK is set, then the socket may be bound
+ * If INP_BINDANY is set, then the socket may be bound
* to any endpoint address, local or not.
*/
- if (
-#if defined(IP_NONLOCALBIND)
- ((inp->inp_flags & INP_NONLOCALOK) == 0) &&
-#endif
- (ifa_ifwithaddr((struct sockaddr *)sin) == 0))
+ if ((inp->inp_flags & INP_BINDANY) == 0 &&
+ ifa_ifwithaddr((struct sockaddr *)sin) == NULL)
return (EADDRNOTAVAIL);
}
laddr = sin->sin_addr;
OpenPOWER on IntegriCloud