diff options
author | YASUOKA Masahiko <yasuoka@cvs.openbsd.org> | 2012-09-17 20:01:27 +0000 |
---|---|---|
committer | YASUOKA Masahiko <yasuoka@cvs.openbsd.org> | 2012-09-17 20:01:27 +0000 |
commit | 7ae5b4210777fba0c46da75f69da33ac20326c6f (patch) | |
tree | 85cc8a11c1f4039aeb90935008177596da0f4adf /sys/netinet6 | |
parent | 67aae5022f47ddfd5a5fcd6c9d001d3dfc52b80d (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/netinet6')
-rw-r--r-- | sys/netinet6/in6.h | 4 | ||||
-rw-r--r-- | sys/netinet6/ip6_output.c | 11 |
2 files changed, 13 insertions, 2 deletions
diff --git a/sys/netinet6/in6.h b/sys/netinet6/in6.h index 70a5f0858c6..9bbec7df68d 100644 --- a/sys/netinet6/in6.h +++ b/sys/netinet6/in6.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.h,v 1.58 2012/09/15 00:47:08 guenther Exp $ */ +/* $OpenBSD: in6.h,v 1.59 2012/09/17 20:01:26 yasuoka Exp $ */ /* $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $ */ /* @@ -451,6 +451,8 @@ struct route_in6 { #define IPV6_DONTFRAG 62 /* bool; disable IPv6 fragmentation */ #define IPV6_PIPEX 63 /* bool; using PIPEX */ +#define IPV6_RECVDSTPORT 64 /* bool; receive IP dst port w/dgram */ + #define IPV6_RTABLE 0x1021 /* int; routing table, see SO_RTABLE */ /* to define items, should talk with KAME guys first, for *BSD compatibility */ diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 07aedeed4d2..05126b62c7f 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_output.c,v 1.125 2012/07/16 18:05:36 markus Exp $ */ +/* $OpenBSD: ip6_output.c,v 1.126 2012/09/17 20:01:26 yasuoka Exp $ */ /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ /* @@ -1356,6 +1356,7 @@ ip6_ctloutput(int op, struct socket *so, int level, int optname, case IPV6_RECVTCLASS: case IPV6_V6ONLY: case IPV6_AUTOFLOWLABEL: + case IPV6_RECVDSTPORT: if (m == NULL || m->m_len != sizeof(int)) { error = EINVAL; break; @@ -1504,6 +1505,9 @@ do { \ OPTSET(IN6P_AUTOFLOWLABEL); break; + case IPV6_RECVDSTPORT: + OPTSET(IN6P_RECVDSTPORT); + break; } break; @@ -1766,6 +1770,7 @@ do { \ case IPV6_PORTRANGE: case IPV6_RECVTCLASS: case IPV6_AUTOFLOWLABEL: + case IPV6_RECVDSTPORT: switch (optname) { case IPV6_RECVHOPOPTS: @@ -1827,6 +1832,10 @@ do { \ case IPV6_AUTOFLOWLABEL: optval = OPTBIT(IN6P_AUTOFLOWLABEL); break; + + case IPV6_RECVDSTPORT: + optval = OPTBIT(IN6P_RECVDSTPORT); + break; } if (error) break; |