net: add a sysctl to reflect the fwmark on replies
authorLorenzo Colitti <lorenzo@google.com>
Tue, 18 Mar 2014 11:52:27 +0000 (20:52 +0900)
committerJP Abgrall <jpa@google.com>
Fri, 16 May 2014 18:41:19 +0000 (18:41 +0000)
commit5a87fa6a43733e241406e8d62fe28fdc0735bf93
treee160aaf2ff683625a97455b1a7f232f254951a66
parenta03f539b1636dd97e7f4f78da08b5e2e02e6cb6d
net: add a sysctl to reflect the fwmark on replies

Kernel-originated IP packets that have no user socket associated
with them (e.g., ICMP errors and echo replies, TCP RSTs, etc.)
are emitted with a mark of zero. Add a sysctl to make them have
the same mark as the packet they are replying to.

This allows an administrator that wishes to do so to use
mark-based routing, firewalling, etc. for these replies by
marking the original packets inbound.

Tested using user-mode linux:
 - ICMP/ICMPv6 echo replies and errors.
 - TCP RST packets (IPv4 and IPv6).

Change-Id: I6873d973196797bcf32e2e91976df647c7e8b85a
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Documentation/networking/ip-sysctl.txt
include/net/ip.h
include/net/ipv6.h
include/net/netns/ipv4.h
include/net/netns/ipv6.h
net/ipv4/icmp.c
net/ipv4/ip_output.c
net/ipv4/sysctl_net_ipv4.c
net/ipv6/icmp.c
net/ipv6/sysctl_net_ipv6.c
net/ipv6/tcp_ipv6.c