diff options
author | Florian Westphal <fw@strlen.de> | 2012-10-29 21:08:49 -0400 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-11-02 07:26:32 -0400 |
commit | 121d1e0941e05c64ee4223064dd83eb24e871739 (patch) | |
tree | a5b841774451210d2d53db14b7cd907cd47f12d4 /include | |
parent | 6229b75d8da5a4eed7bb668de757e252986c2305 (diff) |
netfilter: ipv6: add getsockopt to retrieve origdst
userspace can query the original ipv4 destination address of a REDIRECTed
connection via
getsockopt(m_sock, SOL_IP, SO_ORIGINAL_DST, &m_server_addr, &addrsize)
but for ipv6 no such option existed.
This adds getsockopt(..., IPPROTO_IPV6, IP6T_SO_ORIGINAL_DST, ...).
Without this, userspace needs to parse /proc or use ctnetlink, which
appears to be overkill.
This uses option number 80 for IP6T_SO_ORIGINAL_DST, which is spare,
to use the same number we use in the IPv4 socket option SO_ORIGINAL_DST.
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/uapi/linux/in6.h | 1 | ||||
-rw-r--r-- | include/uapi/linux/netfilter_ipv6/ip6_tables.h | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/include/uapi/linux/in6.h b/include/uapi/linux/in6.h index 1e3159989958..f79c3721da6e 100644 --- a/include/uapi/linux/in6.h +++ b/include/uapi/linux/in6.h | |||
@@ -240,6 +240,7 @@ struct in6_flowlabel_req { | |||
240 | * | 240 | * |
241 | * IP6T_SO_GET_REVISION_MATCH 68 | 241 | * IP6T_SO_GET_REVISION_MATCH 68 |
242 | * IP6T_SO_GET_REVISION_TARGET 69 | 242 | * IP6T_SO_GET_REVISION_TARGET 69 |
243 | * IP6T_SO_ORIGINAL_DST 80 | ||
243 | */ | 244 | */ |
244 | 245 | ||
245 | /* RFC5014: Source address selection */ | 246 | /* RFC5014: Source address selection */ |
diff --git a/include/uapi/linux/netfilter_ipv6/ip6_tables.h b/include/uapi/linux/netfilter_ipv6/ip6_tables.h index bf1ef65cc582..649c68062dca 100644 --- a/include/uapi/linux/netfilter_ipv6/ip6_tables.h +++ b/include/uapi/linux/netfilter_ipv6/ip6_tables.h | |||
@@ -178,6 +178,9 @@ struct ip6t_error { | |||
178 | #define IP6T_SO_GET_REVISION_TARGET (IP6T_BASE_CTL + 5) | 178 | #define IP6T_SO_GET_REVISION_TARGET (IP6T_BASE_CTL + 5) |
179 | #define IP6T_SO_GET_MAX IP6T_SO_GET_REVISION_TARGET | 179 | #define IP6T_SO_GET_MAX IP6T_SO_GET_REVISION_TARGET |
180 | 180 | ||
181 | /* obtain original address if REDIRECT'd connection */ | ||
182 | #define IP6T_SO_ORIGINAL_DST 80 | ||
183 | |||
181 | /* ICMP matching stuff */ | 184 | /* ICMP matching stuff */ |
182 | struct ip6t_icmp { | 185 | struct ip6t_icmp { |
183 | __u8 type; /* type to match */ | 186 | __u8 type; /* type to match */ |