android_kernel_google_msm/net/ipv4
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 netfilter: x_tables: fix ordering of jumpstack allocation and table update 2014-01-02 19:07:05 -08:00
af_inet.c Merge upstream linux-stable v3.10.28 into msm-3.10 2014-03-24 14:28:34 -07:00
ah4.c
arp.c
cipso_ipv4.c
datagram.c ipv4: fix possible seqlock deadlock 2013-12-08 07:29:25 -08:00
devinet.c Merge upstream linux-stable v3.10.36 into msm-3.10 2014-04-23 16:23:49 -07:00
esp4.c
fib_frontend.c fib_frontend: fix possible NULL pointer dereference 2014-02-06 11:08:16 -08:00
fib_lookup.h
fib_rules.c
fib_semantics.c
fib_trie.c seq_file: remove "%n" usage from seq_file users 2014-06-02 14:20:27 -07:00
gre.c
icmp.c net: add a sysctl to reflect the fwmark on replies 2014-06-23 15:20:28 -07:00
igmp.c ipv4 igmp: use in_dev_put in timer handlers instead of __in_dev_put 2013-10-13 16:08:30 -07:00
inet_connection_sock.c net: support marking accepting TCP sockets 2014-06-23 15:21:22 -07:00
inet_diag.c inet_diag: fix inet_diag_dump_icsk() timewait socket state logic 2014-02-06 11:08:16 -08:00
inet_fragment.c Merge upstream tag 'v3.10.40' into msm-3.10 2014-06-18 13:10:54 -07:00
inet_hashtables.c net: do not call sock_put() on TIMEWAIT sockets 2013-11-04 04:31:00 -08:00
inet_lro.c
inet_timewait_sock.c
inetpeer.c ip: generate unique IP identificator if local fragmentation is allowed 2013-10-13 16:08:30 -07:00
ip_forward.c net: ip, ipv6: handle gso skbs in forwarding path 2014-03-06 21:30:05 -08:00
ip_fragment.c
ip_gre.c ip_gre: fix msg_name parsing for recvfrom/recvmsg 2014-01-15 15:28:48 -08:00
ip_input.c net: Fix memory leak if TPROXY used with TCP early demux 2014-02-06 11:08:17 -08:00
ip_options.c
ip_output.c net: add a sysctl to reflect the fwmark on replies 2014-06-23 15:20:28 -07:00
ip_sockglue.c inet: fix addr_len/msg->msg_namelen assignment in recv_error and rxpmtu functions 2013-12-08 07:29:25 -08:00
ip_tunnel.c ip_tunnel: clear IPCB in ip_tunnel_xmit() in case dst_link_failure() is called 2014-02-06 11:08:16 -08:00
ip_vti.c xfrm: Release dst if this dst is improper for vti tunnel 2013-12-08 07:29:25 -08:00
ipcomp.c
ipconfig.c
ipip.c ip_gre: Fix WCCPv2 header parsing. 2013-11-20 12:27:46 -08:00
ipmr.c ipmr: fix mfc notification flags 2014-04-14 06:42:17 -07:00
Kconfig
Makefile
netfilter.c
ping.c net: ipv4: current group_info should be put after using. 2014-06-23 14:39:30 -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
route.c net: Use fwmark reflection in PMTU discovery. 2014-06-23 15:21:20 -07:00
syncookies.c net: support marking accepting TCP sockets 2014-06-23 15:21:22 -07:00
sysctl_net_ipv4.c net: support marking accepting TCP sockets 2014-06-23 15:21:22 -07:00
sysfs_net_ipv4.c msm-3.10: Create shadow files under /sys/kernel/ipv4 2014-04-28 15:36:07 -07:00
tcp.c Merge upstream linux-stable v3.10.36 into msm-3.10 2014-04-23 16:23:49 -07:00
tcp_bic.c
tcp_cong.c
tcp_cubic.c tcp: cubic: fix bug in bictcp_acked() 2013-09-14 06:54:54 -07:00
tcp_diag.c
tcp_fastopen.c
tcp_highspeed.c
tcp_htcp.c
tcp_hybla.c
tcp_illinois.c
tcp_input.c tcp: add a sysctl to config the tcp_default_init_rwnd 2014-06-13 12:06:15 -07:00
tcp_ipv4.c net: support marking accepting TCP sockets 2014-06-23 15:21:22 -07:00
tcp_lp.c
tcp_memcontrol.c
tcp_metrics.c tcp: metrics: Avoid duplicate entries with the same destination-IP 2014-02-06 11:08:16 -08:00
tcp_minisocks.c
tcp_output.c Merge upstream tag 'v3.10.40' into msm-3.10 2014-06-18 13:10:54 -07:00
tcp_probe.c
tcp_scalable.c
tcp_timer.c WLAN subsystem: Sysctl support for key TCP/IP parameters 2014-01-08 19:46:01 -08:00
tcp_vegas.c
tcp_vegas.h
tcp_veno.c
tcp_westwood.c
tcp_yeah.c
tunnel4.c
udp.c seq_file: remove "%n" usage from seq_file users 2014-06-02 14:20:27 -07:00
udp_diag.c
udp_impl.h
udplite.c
xfrm4_input.c
xfrm4_mode_beet.c
xfrm4_mode_transport.c
xfrm4_mode_tunnel.c ip: generate unique IP identificator if local fragmentation is allowed 2013-10-13 16:08:30 -07:00
xfrm4_output.c
xfrm4_policy.c
xfrm4_state.c
xfrm4_tunnel.c