linux-xiaomi-chiron/include/linux/netfilter
Jozsef Kadlecsik 874ab9233e netfilter: nf_ct_tcp: TCP simultaneous open support
The patch below adds supporting TCP simultaneous open to conntrack. The
unused LISTEN state is replaced by a new state (SYN_SENT2) denoting the
second SYN sent from the reply direction in the new case. The state table
is updated and the function tcp_in_window is modified to handle
simultaneous open.

The functionality can fairly easily be tested by socat. A sample tcpdump
recording

23:21:34.244733 IP (tos 0x0, ttl 64, id 49224, offset 0, flags [DF], proto TCP (6), length 60) 192.168.0.254.2020 > 192.168.0.1.2020: S, cksum 0xe75f (correct), 3383710133:3383710133(0) win 5840 <mss 1460,sackOK,timestamp 173445629 0,nop,wscale 7>
23:21:34.244783 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40) 192.168.0.1.2020 > 192.168.0.254.2020: R, cksum 0x0253 (correct), 0:0(0) ack 3383710134 win 0
23:21:36.038680 IP (tos 0x0, ttl 64, id 28092, offset 0, flags [DF], proto TCP (6), length 60) 192.168.0.1.2020 > 192.168.0.254.2020: S, cksum 0x704b (correct), 2634546729:2634546729(0) win 5840 <mss 1460,sackOK,timestamp 824213 0,nop,wscale 1>
23:21:36.038777 IP (tos 0x0, ttl 64, id 49225, offset 0, flags [DF], proto TCP (6), length 60) 192.168.0.254.2020 > 192.168.0.1.2020: S, cksum 0xb179 (correct), 3383710133:3383710133(0) ack 2634546730 win 5840 <mss 1460,sackOK,timestamp 173447423 824213,nop,wscale 7>
23:21:36.038847 IP (tos 0x0, ttl 64, id 28093, offset 0, flags [DF], proto TCP (6), length 52) 192.168.0.1.2020 > 192.168.0.254.2020: ., cksum 0xebad (correct), ack 3383710134 win 2920 <nop,nop,timestamp 824213 173447423>

and the corresponding netlink events:

    [NEW] tcp      6 120 SYN_SENT src=192.168.0.254 dst=192.168.0.1 sport=2020 dport=2020 [UNREPLIED] src=192.168.0.1 dst=192.168.0.254 sport=2020 dport=2020
 [UPDATE] tcp      6 120 LISTEN src=192.168.0.254 dst=192.168.0.1 sport=2020 dport=2020 src=192.168.0.1 dst=192.168.0.254 sport=2020 dport=2020
 [UPDATE] tcp      6 60 SYN_RECV src=192.168.0.254 dst=192.168.0.1 sport=2020 dport=2020 src=192.168.0.1 dst=192.168.0.254 sport=2020 dport=2020
 [UPDATE] tcp      6 432000 ESTABLISHED src=192.168.0.254 dst=192.168.0.1 sport=2020 dport=2020 src=192.168.0.1 dst=192.168.0.254 sport=2020 dport=2020 [ASSURED]

The RST packet was dropped in the raw table, thus it did not reach
conntrack.  nfnetlink_conntrack is unpatched so it shows the new SYN_SENT2
state as the old unused LISTEN.

With TCP simultaneous open support we satisfy REQ-2 in RFC 5382  ;-) .

Additional minor correction in this patch is that in order to catch
uninitialized reply directions, "td_maxwin == 0" is used instead of
"td_end == 0" because the former can't be true except in uninitialized
state while td_end may accidentally be equal to zero in the mid of a
connection.

Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Patrick McHardy <kaber@trash.net>
2009-06-02 13:58:56 +02:00
..
Kbuild netfilter: xtables: add cluster match 2009-03-16 17:10:36 +01:00
nf_conntrack_amanda.h [NETFILTER]: Replace sk_buff ** with sk_buff * 2007-10-15 12:26:29 -07:00
nf_conntrack_common.h netfilter: accounting rework: ct_extend + 64bit counters (v4) 2008-07-21 10:10:58 -07:00
nf_conntrack_dccp.h [NETFILTER]: nf_conntrack: add DCCP protocol support 2008-04-14 11:15:49 +02:00
nf_conntrack_ftp.h [NETFILTER]: Replace sk_buff ** with sk_buff * 2007-10-15 12:26:29 -07:00
nf_conntrack_h323.h [NETFILTER]: Introduce nf_inet_address 2008-01-28 14:59:07 -08:00
nf_conntrack_h323_asn1.h
nf_conntrack_h323_types.h [NETFILTER]: nf_conntrack_h323: fix ASN.1 types 2007-05-24 16:42:26 -07:00
nf_conntrack_irc.h [NETFILTER]: Replace sk_buff ** with sk_buff * 2007-10-15 12:26:29 -07:00
nf_conntrack_pptp.h [NETFILTER]: nf_{conntrack,nat}_pptp: annotate PPtP helper with const 2008-01-31 19:28:09 -08:00
nf_conntrack_proto_gre.h netfilter: netns nf_conntrack: GRE conntracking in netns 2008-10-08 11:35:10 +02:00
nf_conntrack_sane.h
nf_conntrack_sctp.h [NETFILTER]: nf_conntrack_sctp: remove unused ttag field from conntrack data 2008-01-28 15:02:38 -08:00
nf_conntrack_sip.h netfilter: nf_conntrack_sip: restrict RTP expect flushing on error to last request 2008-05-08 01:15:21 -07:00
nf_conntrack_tcp.h netfilter: nf_ct_tcp: TCP simultaneous open support 2009-06-02 13:58:56 +02:00
nf_conntrack_tftp.h [NETFILTER]: Replace sk_buff ** with sk_buff * 2007-10-15 12:26:29 -07:00
nf_conntrack_tuple_common.h
nfnetlink.h Merge branch 'header-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-03-26 16:11:41 -07:00
nfnetlink_compat.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
nfnetlink_conntrack.h netfilter: conntrack: add support for DCCP handshake sequence to ctnetlink 2009-05-27 17:50:35 +02:00
nfnetlink_log.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
nfnetlink_queue.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
x_tables.h netfilter: use likely() in xt_info_rdlock_bh() 2009-05-01 09:10:46 -07:00
xt_CLASSIFY.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_cluster.h netfilter: xt_cluster: fix use of cluster match with 32 nodes 2009-05-05 17:46:07 +02:00
xt_comment.h
xt_connbytes.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_connlimit.h [NETFILTER]: Annotate start of kernel fields in NF headers 2008-01-28 15:02:19 -08:00
xt_CONNMARK.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_connmark.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_CONNSECMARK.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_conntrack.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_dccp.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_DSCP.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_dscp.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_esp.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_hashlimit.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_helper.h
xt_iprange.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_LED.h netfilter: add missing linux/types.h include to xt_LED.h 2009-05-05 14:31:12 +02:00
xt_length.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_limit.h Merge branch 'header-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-03-26 16:11:41 -07:00
xt_mac.h
xt_mark.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_MARK.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_multiport.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_NFLOG.h Merge commit 'v2.6.29' into core/header-fixes 2009-03-26 18:29:40 +01:00
xt_NFQUEUE.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_owner.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_physdev.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_pkttype.h
xt_policy.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_quota.h netfilter: xtables: avoid pointer to self 2009-03-16 15:35:29 +01:00
xt_RATEEST.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_rateest.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_realm.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_recent.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_sctp.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_SECMARK.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_state.h
xt_statistic.h Merge branch 'header-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-03-26 16:11:41 -07:00
xt_string.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_TCPMSS.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_tcpmss.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_TCPOPTSTRIP.h [NETFILTER]: x_tables: add TCPOPTSTRIP target 2008-01-28 14:55:51 -08:00
xt_tcpudp.h make netfilter use strict integer types 2009-03-26 18:14:20 +01:00
xt_time.h [NETFILTER]: x_tables: add xt_time match 2007-10-10 16:53:40 -07:00
xt_TPROXY.h netfilter: iptables TPROXY target 2008-10-08 11:35:12 +02:00
xt_u32.h [NETFILTER]: Add u32 match 2007-07-10 22:17:13 -07:00