History

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.

Florian Westphal committed 14 years ago

Commit 121d1e01 parent 6229b753 files · +65 −0Browse files

Showing the changes to include/uapi/linux (2 of 3 files). Show all

Unified · Split

2 files
  1. include/uapi/linux/in6.h +1 −0
  2. include/uapi/linux/netfilter_ipv6/ip6_tables.h +3 −0
include/uapi/linux/in6.h+1−0
@@ -240,6 +240,7 @@ struct in6_flowlabel_req { · 239 unmodified lines
240240 *
241241 * IP6T_SO_GET_REVISION_MATCH 68
242242 * IP6T_SO_GET_REVISION_TARGET 69
243+ * IP6T_SO_ORIGINAL_DST 80
243244 */
244245
245246 /* RFC5014: Source address selection */
include/uapi/linux/netfilter_ipv6/ip6_tables.h+3−0
@@ -178,6 +178,9 @@ struct ip6t_error { · 177 unmodified lines
178178 #define IP6T_SO_GET_REVISION_TARGET (IP6T_BASE_CTL + 5)
179179 #define IP6T_SO_GET_MAX IP6T_SO_GET_REVISION_TARGET
180180
181+/* obtain original address if REDIRECT'd connection */
182+#define IP6T_SO_ORIGINAL_DST 80
183+
181184 /* ICMP matching stuff */
182185 struct ip6t_icmp {
183186 __u8 type; /* type to match */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t