summaryrefslogtreecommitdiffstats
path: root/sys/netinet/raw_ip.c
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2008-05-09 02:52:15 +0000
committermarkus <markus@openbsd.org>2008-05-09 02:52:15 +0000
commit338fceb4a95edb6498c1dac3afa93de1693c71fb (patch)
tree79d42f919f93236f2e27fcb5dc1069139c483854 /sys/netinet/raw_ip.c
parentdivert packets to local socket without modifying the ip header; (diff)
downloadwireguard-openbsd-338fceb4a95edb6498c1dac3afa93de1693c71fb.tar.xz
wireguard-openbsd-338fceb4a95edb6498c1dac3afa93de1693c71fb.zip
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/raw_ip.c')
-rw-r--r--sys/netinet/raw_ip.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index 3b621e57678..1b45549be3c 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip.c,v 1.42 2008/05/09 02:44:54 markus Exp $ */
+/* $OpenBSD: raw_ip.c,v 1.43 2008/05/09 02:52:15 markus Exp $ */
/* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */
/*
@@ -408,7 +408,8 @@ rip_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
((addr->sin_family != AF_INET) &&
(addr->sin_family != AF_IMPLINK)) ||
(addr->sin_addr.s_addr &&
- ifa_ifwithaddr(sintosa(addr)) == 0)) {
+ (!(so->so_options & SO_BINDANY) &&
+ in_iawithaddr(addr->sin_addr, NULL) == 0))) {
error = EADDRNOTAVAIL;
break;
}