android_kernel_sony_msm8994/net/ipv6
Lorenzo Colitti c5f40c905b net: support marking accepting TCP sockets
When using mark-based routing, sockets returned from accept()
may need to be marked differently depending on the incoming
connection request.

This is the case, for example, if different socket marks identify
different networks: a listening socket may want to accept
connections from all networks, but each connection should be
marked with the network that the request came in on, so that
subsequent packets are sent on the correct network.

This patch adds a sysctl to mark TCP sockets based on the fwmark
of the incoming SYN packet. If enabled, and an unmarked socket
receives a SYN, then the SYN packet's fwmark is written to the
connection's inet_request_sock, and later written back to the
accepted socket when the connection is established.  If the
socket already has a nonzero mark, then the behaviour is the same
as it is today, i.e., the listening socket's fwmark is used.

Black-box tested using user-mode linux:

- IPv4/IPv6 SYN+ACK, FIN, etc. packets are routed based on the
  mark of the incoming SYN packet.
- The socket returned by accept() is marked with the mark of the
  incoming SYN packet.
- Tested with syncookies=1 and syncookies=2.

Change-Id: I26bc1eceefd2c588d73b921865ab70e4645ade57
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Git-commit: 6ba3a0e3b112bdb47858e97aa763706ba26ca5ea
Git-repo: https://android.googlesource.com/kernel/common.git
Signed-off-by: Ian Maund <imaund@codeaurora.org>
2014-06-23 15:21:22 -07:00
..
netfilter Merge upstream linux-stable v3.10.28 into msm-3.10 2014-03-24 14:28:34 -07:00
addrconf_core.c
addrconf.c net: ipv6: autoconf routes into per-device tables 2014-06-23 15:13:13 -07:00
addrlabel.c ipv6: fix null pointer dereference in __ip6addrlbl_add 2013-09-14 06:54:56 -07:00
af_inet6.c net: ipv6: Add IPv6 support to the ping socket. 2014-05-06 09:18:35 -06:00
ah6.c
anycast.c
datagram.c ipv6: fix leaking uninitialized port number of offender sockaddr 2013-12-08 07:29:25 -08:00
esp6.c
exthdrs_core.c Merge upstream linux-stable v3.10.36 into msm-3.10 2014-04-23 16:23:49 -07:00
exthdrs_offload.c ipv6: Fix exthdrs offload registration. 2014-04-14 06:42:16 -07:00
exthdrs.c ipv6/exthdrs: accept tlv which includes only padding 2013-10-13 16:08:28 -07:00
fib6_rules.c
icmp.c net: add a sysctl to reflect the fwmark on replies 2014-06-23 15:20:28 -07:00
inet6_connection_sock.c net: support marking accepting TCP sockets 2014-06-23 15:21:22 -07:00
inet6_hashtables.c net: do not call sock_put() on TIMEWAIT sockets 2013-11-04 04:31:00 -08:00
ip6_checksum.c
ip6_fib.c net: fib: fib6_add: fix potential NULL pointer dereference 2013-10-13 16:08:28 -07:00
ip6_flowlabel.c ipv6: protect for_each_sk_fl_rcu in mem_check with rcu_read_lock_bh 2013-12-08 07:29:24 -08:00
ip6_gre.c ipv6: gre: correct calculation of max_headroom 2013-10-13 16:08:30 -07:00
ip6_icmp.c
ip6_input.c net: Fix memory leak if TPROXY used with TCP early demux 2014-02-06 11:08:17 -08:00
ip6_offload.c
ip6_offload.h
ip6_output.c Merge upstream tag 'v3.10.40' into msm-3.10 2014-06-18 13:10:54 -07:00
ip6_tunnel.c ip6tnl: fix double free of fb_tnl_dev on exit 2014-02-06 11:08:17 -08:00
ip6mr.c ip6mr: fix mfc notification flags 2014-04-14 06:42:17 -07:00
ipcomp6.c
ipv6_sockglue.c
Kconfig
Makefile net: ipv6: Add IPv6 support to the ping socket. 2014-05-06 09:18:35 -06:00
mcast.c ipv6: some ipv6 statistic counters failed to disable bh 2014-04-14 06:42:18 -07:00
mip6.c
ndisc.c ipv6: Don't depend on per socket memory for neighbour discovery messages 2013-09-14 06:54:56 -07:00
netfilter.c
output_core.c
ping.c net: ipv6: ping: Use socket mark in routing lookup 2014-06-23 15:01:35 -07:00
proc.c
protocol.c
raw.c inet: fix addr_len/msg->msg_namelen assignment in recv_error and rxpmtu functions 2013-12-08 07:29:25 -08:00
reassembly.c ipv6: drop packets with multiple fragmentation headers 2013-09-14 06:54:55 -07:00
route.c net: Use fwmark reflection in PMTU discovery. 2014-06-23 15:21:20 -07:00
sit.c sit: fix double free of fb_tunnel_dev on exit 2014-02-06 11:08:17 -08:00
syncookies.c net: support marking accepting TCP sockets 2014-06-23 15:21:22 -07:00
sysctl_net_ipv6.c net: add a sysctl to reflect the fwmark on replies 2014-06-23 15:20:28 -07:00
tcp_ipv6.c net: support marking accepting TCP sockets 2014-06-23 15:21:22 -07:00
tcpv6_offload.c
tunnel6.c
udp_impl.h
udp_offload.c ipv6: reuse ip6_frag_id from ip6_ufo_append_data 2014-03-23 21:38:10 -07:00
udp.c inet: fix addr_len/msg->msg_namelen assignment in recv_error and rxpmtu functions 2013-12-08 07:29:25 -08:00
udplite.c
xfrm6_input.c
xfrm6_mode_beet.c
xfrm6_mode_ro.c
xfrm6_mode_transport.c
xfrm6_mode_tunnel.c
xfrm6_output.c
xfrm6_policy.c
xfrm6_state.c
xfrm6_tunnel.c