From 5dc5e5de07068e27353f70fa51fe1fdd4165b68e Mon Sep 17 00:00:00 2001 From: Markus Friedl Date: Fri, 9 May 2008 02:56:37 +0000 Subject: 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@ --- sys/netinet/ip_output.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'sys/netinet/ip_output.c') 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; -- cgit v1.2.3