summaryrefslogtreecommitdiff
path: root/sys/netinet/in_pcb.c
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2008-05-09 02:52:16 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2008-05-09 02:52:16 +0000
commit4d2f26f40d056a33f87aed5cd294af089da41a7a (patch)
tree25190aa4a30a5592eb03b5d2fe08e9634636780f /sys/netinet/in_pcb.c
parent6b5278216d3e945e7764e8fb4d6084731d9c1d42 (diff)
Add SO_BINDANY socket option from BSD/OS.
The option allows a socket to be bound to addresses which are not local to the machine. In order to receive packets for these addresses SO_BINDANY needs to be combined with matching outgoing pf(4) divert rules, see pf.conf(5). ok beck@
Diffstat (limited to 'sys/netinet/in_pcb.c')
-rw-r--r--sys/netinet/in_pcb.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index e3e8d58bdfa..58702c81a36 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.c,v 1.95 2008/05/09 02:44:54 markus Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.96 2008/05/09 02:52:15 markus Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@@ -284,7 +284,8 @@ in_pcbbind(v, nam)
reuseport = SO_REUSEADDR|SO_REUSEPORT;
} else if (sin->sin_addr.s_addr != INADDR_ANY) {
sin->sin_port = 0; /* yech... */
- if (in_iawithaddr(sin->sin_addr, NULL) == 0)
+ if (!(so->so_options & SO_BINDANY) &&
+ in_iawithaddr(sin->sin_addr, NULL) == 0)
return (EADDRNOTAVAIL);
}
if (lport) {