summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_output.c
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2008-05-09 02:56:37 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2008-05-09 02:56:37 +0000
commit5dc5e5de07068e27353f70fa51fe1fdd4165b68e (patch)
tree603fb0e086b78e5b92de28bf65f22a35f1471167 /sys/netinet/ip_output.c
parent4d2f26f40d056a33f87aed5cd294af089da41a7a (diff)
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.c10
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;