summaryrefslogtreecommitdiff
path: root/sys/netinet/udp_usrreq.c
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2012-09-17 20:01:27 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2012-09-17 20:01:27 +0000
commit7ae5b4210777fba0c46da75f69da33ac20326c6f (patch)
tree85cc8a11c1f4039aeb90935008177596da0f4adf /sys/netinet/udp_usrreq.c
parent67aae5022f47ddfd5a5fcd6c9d001d3dfc52b80d (diff)
add IPV6_RECVDSTPORT socket option, which enables us to get original
(= before divert) destination port of a UDP packet. The way to use this option is same as IP_RECVDSTPORT. from UMEZAWA Takeshi tweaks from jmc; ok henning bluhm
Diffstat (limited to 'sys/netinet/udp_usrreq.c')
-rw-r--r--sys/netinet/udp_usrreq.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 5a8d8e596e4..48700af5473 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udp_usrreq.c,v 1.149 2012/07/17 03:18:57 yasuoka Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.150 2012/09/17 20:01:26 yasuoka Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
@@ -688,6 +688,16 @@ udp_input(struct mbuf *m, ...)
if (ip && (inp->inp_flags & INP_CONTROLOPTS ||
inp->inp_socket->so_options & SO_TIMESTAMP))
ip_savecontrol(inp, &opts, ip, m);
+#ifdef INET6
+ if (ip6 && (inp->inp_flags & IN6P_RECVDSTPORT)) {
+ struct mbuf **mp = &opts;
+
+ while (*mp)
+ mp = &(*mp)->m_next;
+ *mp = sbcreatecontrol((caddr_t)&uh->uh_dport, sizeof(u_int16_t),
+ IPV6_RECVDSTPORT, IPPROTO_IPV6);
+ }
+#endif /* INET6 */
if (ip && (inp->inp_flags & INP_RECVDSTPORT)) {
struct mbuf **mp = &opts;