netfilter: ipv6: add getsockopt to retrieve origdst
authorFlorian Westphal <fw@strlen.de>
Tue, 30 Oct 2012 01:08:49 +0000 (01:08 +0000)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 2 Nov 2012 11:26:32 +0000 (12:26 +0100)
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>

No differences found