android_kernel_sony_msm8994/net
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
..
9p 9p/trans_virtio.c: Fix broken zero-copy on vmalloc() buffers 2014-03-06 21:30:03 -08:00
802
8021q vlan: Set hard_header_len according to available acceleration 2014-04-14 06:42:18 -07:00
appletalk net: rework recvmsg handler msg_name and msg_namelen logic 2013-12-08 07:29:25 -08:00
atm net: rework recvmsg handler msg_name and msg_namelen logic 2013-12-08 07:29:25 -08:00
ax25 net: rework recvmsg handler msg_name and msg_namelen logic 2013-12-08 07:29:25 -08:00
batman-adv batman-adv: set up network coding packet handlers during module init 2013-11-20 12:27:47 -08:00
bluetooth Merge upstream tag 'v3.10.40' into msm-3.10 2014-06-18 13:10:54 -07:00
bridge Merge upstream tag 'v3.10.40' into msm-3.10 2014-06-18 13:10:54 -07:00
caif Merge upstream linux-stable v3.10.28 into msm-3.10 2014-03-24 14:28:34 -07:00
can can: add destructor for self generated skbs 2014-03-06 21:30:03 -08:00
ceph libceph: resend all writes after the osdmap loses the full flag 2014-03-31 09:58:13 -07:00
core Merge upstream tag 'v3.10.40' into msm-3.10 2014-06-18 13:10:54 -07:00
dcb
dccp net:dccp: do not report ICMP redirects to user space 2013-10-13 16:08:30 -07:00
decnet
dns_resolver
dsa
ethernet
ieee802154 6lowpan: fix lockdep splats 2014-03-06 21:30:02 -08:00
ipc_router Merge "drivers: ipc_hsic: Add support for fragmentation and re-assembly" 2014-06-05 16:38:28 -07:00
ipv4 net: support marking accepting TCP sockets 2014-06-23 15:21:22 -07:00
ipv6 net: support marking accepting TCP sockets 2014-06-23 15:21:22 -07:00
ipx net: rework recvmsg handler msg_name and msg_namelen logic 2013-12-08 07:29:25 -08:00
irda net: rework recvmsg handler msg_name and msg_namelen logic 2013-12-08 07:29:25 -08:00
iucv Merge upstream linux-stable v3.10.28 into msm-3.10 2014-03-24 14:28:34 -07:00
key Merge upstream linux-stable v3.10.28 into msm-3.10 2014-03-24 14:28:34 -07:00
l2tp inet: fix addr_len/msg->msg_namelen assignment in recv_error and rxpmtu functions 2013-12-08 07:29:25 -08:00
lapb
llc net: llc: fix use after free in llc_ui_recvmsg 2014-01-15 15:28:50 -08:00
mac80211 Merge upstream tag 'v3.10.40' into msm-3.10 2014-06-18 13:10:54 -07:00
mac802154
netfilter nf: Remove compilation error caused by 2014-06-23 14:39:26 -07:00
netlabel
netlink genetlink: fix usage of NLM_F_EXCL or NLM_F_REPLACE 2014-04-08 17:47:26 -07:00
netrom net: rework recvmsg handler msg_name and msg_namelen logic 2013-12-08 07:29:25 -08:00
nfc net: rework recvmsg handler msg_name and msg_namelen logic 2013-12-08 07:29:25 -08:00
openvswitch
packet Merge upstream linux-stable v3.10.28 into msm-3.10 2014-03-24 14:28:34 -07:00
phonet seq_file: remove "%n" usage from seq_file users 2014-06-02 14:20:27 -07:00
rds rds: prevent dereference of a NULL device in rds_iw_laddr_check 2014-04-14 06:42:18 -07:00
rfkill
rmnet_data net: rmnet_data: modify the packet logging 2014-06-06 12:51:21 -06:00
rose net: rose: restore old recvmsg behavior 2014-01-15 15:28:49 -08:00
rxrpc Merge upstream linux-stable v3.10.28 into msm-3.10 2014-03-24 14:28:34 -07:00
sched net: tc_qdisc_flow_control returning qdisc size 2014-05-29 11:20:36 -06:00
sctp Merge upstream tag 'v3.10.40' into msm-3.10 2014-06-18 13:10:54 -07:00
sunrpc Merge upstream tag 'v3.10.40' into msm-3.10 2014-06-18 13:10:54 -07:00
tipc net: rework recvmsg handler msg_name and msg_namelen logic 2013-12-08 07:29:25 -08:00
unix Merge upstream tag 'v3.10.40' into msm-3.10 2014-06-18 13:10:54 -07:00
vmw_vsock net: rework recvmsg handler msg_name and msg_namelen logic 2013-12-08 07:29:25 -08:00
wimax
wireless cfg80211: Dynamic channel bandwidth changes in AP mode 2014-05-27 11:29:05 -07:00
x25 net: rework recvmsg handler msg_name and msg_namelen logic 2013-12-08 07:29:25 -08:00
xfrm
activity_stats.c net: activity_stats: Stop using obsolete create_proc_read_entry api 2013-07-01 15:52:02 -07:00
compat.c x86, x32: Correct invalid use of user timespec in the kernel 2014-02-06 11:08:12 -08:00
Kconfig net: sockev: Initial Commit 2014-06-06 17:01:51 -07:00
Makefile msm: ipc: Support multi-platform 2014-01-13 13:51:09 -07:00
nonet.c
socket.c Merge upstream tag 'v3.10.40' into msm-3.10 2014-06-18 13:10:54 -07:00
sysctl_net.c net: Update the sysctl permissions handler to test effective uid/gid 2013-10-13 16:08:34 -07:00