diff options
author | 2008-05-09 02:56:36 +0000 | |
---|---|---|
committer | 2008-05-09 02:56:36 +0000 | |
commit | d33f8909fad7e30f8838b6c8a4e8b268291928fc (patch) | |
tree | 8b567ab1d4a04323d8bdb536b61d4ed048b3e5bc /sys/netinet/ip_output.c | |
parent | Add SO_BINDANY socket option from BSD/OS. (diff) | |
download | wireguard-openbsd-d33f8909fad7e30f8838b6c8a4e8b268291928fc.tar.xz wireguard-openbsd-d33f8909fad7e30f8838b6c8a4e8b268291928fc.zip |
IP_RECVDSTPORT, allows you to get the destination port of UDP datagrams
for pf(4) diverted packets; based on patch by Scot Loach; ok beck@
Diffstat (limited to 'sys/netinet/ip_output.c')
-rw-r--r-- | sys/netinet/ip_output.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 0490f62a3cd..4295f647bed 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_output.c,v 1.190 2007/10/29 16:19:23 chl Exp $ */ +/* $OpenBSD: ip_output.c,v 1.191 2008/05/09 02:56:36 markus Exp $ */ /* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */ /* @@ -1063,6 +1063,7 @@ ip_ctloutput(op, so, level, optname, mp) case IP_RECVDSTADDR: case IP_RECVIF: case IP_RECVTTL: + case IP_RECVDSTPORT: if (m == NULL || m->m_len != sizeof(int)) error = EINVAL; else { @@ -1109,6 +1110,9 @@ ip_ctloutput(op, so, level, optname, mp) case IP_RECVTTL: OPTSET(INP_RECVTTL); break; + case IP_RECVDSTPORT: + OPTSET(INP_RECVDSTPORT); + break; } } break; @@ -1412,6 +1416,7 @@ ip_ctloutput(op, so, level, optname, mp) case IP_RECVDSTADDR: case IP_RECVIF: case IP_RECVTTL: + case IP_RECVDSTPORT: *mp = m = m_get(M_WAIT, MT_SOOPTS); m->m_len = sizeof(int); switch (optname) { @@ -1447,6 +1452,9 @@ ip_ctloutput(op, so, level, optname, mp) case IP_RECVTTL: optval = OPTBIT(INP_RECVTTL); break; + case IP_RECVDSTPORT: + optval = OPTBIT(INP_RECVDSTPORT); + break; } *mtod(m, int *) = optval; break; |