kernel-ark/net/netfilter
Pablo Neira Ayuso 8a80c79a77 netfilter: nf_ct_tcp: fix out of sync scenario while in SYN_RECV
This patch fixes the out of sync scenarios while in SYN_RECV state.

Quoting Jozsef, what it happens if we are out of sync if the
following:

> > b. conntrack entry is outdated, new SYN received
> >    - (b1) we ignore it but save the initialization data from it
> >    - (b2) when the reply SYN/ACK receives and it matches the saved data,
> >      we pick up the new connection
This is what it should happen if we are in SYN_RECV state. Initially,
the SYN packet hits b1, thus we save data from it. But the SYN/ACK
packet is considered a retransmission given that we're in SYN_RECV
state. Therefore, we never hit b2 and we don't get in sync. To fix
this, we ignore SYN/ACK if we are in SYN_RECV. If the previous packet
was a SYN, then we enter the ignore case that get us in sync.

This patch helps a lot to conntrackd in stress scenarios (assumming a
client that generates lots of small TCP connections). During the failover,
consider that the new primary has injected one outdated flow in SYN_RECV
state (this is likely to happen if the conntrack event rate is high
because the backup will be a bit delayed from the primary). With the
current code, if the client starts a new fresh connection that matches
the tuple, the SYN packet will be ignored without updating the state
tracking, and the SYN+ACK in reply will blocked as it will not pass
checkings III or IV (since all state tracking in the original direction
is not initialized because of the SYN packet was ignored and the ignore
case that get us in sync is not applied).

I posted a couple of patches before this one. Changli Gao spotted
a simpler way to fix this problem. This patch implements his idea.

Cc: Changli Gao <xiaosuo@gmail.com>
Cc: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Patrick McHardy <kaber@trash.net>
2011-02-28 18:02:33 +01:00
..
ipset netfilter: ipset: add dependency on CONFIG_NETFILTER_NETLINK 2011-02-10 10:13:07 +01:00
ipvs ipvs: unify the formula to estimate the overhead of processing connections 2011-02-25 11:35:41 +09:00
core.c netfilter: allow NFQUEUE bypass if no listener is available 2011-01-18 16:08:30 +01:00
Kconfig netfilter: xtables: add device group match 2011-02-03 00:05:43 +01:00
Makefile netfilter: xtables: add device group match 2011-02-03 00:05:43 +01:00
nf_conntrack_acct.c
nf_conntrack_amanda.c
nf_conntrack_broadcast.c netfilter: nf_conntrack: nf_conntrack snmp helper 2011-01-18 18:12:24 +01:00
nf_conntrack_core.c netfilter: nf_conntrack_tstamp: add flow-based timestamp extension 2011-01-19 16:00:07 +01:00
nf_conntrack_ecache.c
nf_conntrack_expect.c netfilter: nf_conntrack: use is_vmalloc_addr() 2011-01-14 15:45:56 +01:00
nf_conntrack_extend.c netfilter: rcu sparse cleanups 2010-11-15 19:45:13 +01:00
nf_conntrack_ftp.c
nf_conntrack_h323_asn1.c
nf_conntrack_h323_main.c
nf_conntrack_h323_types.c
nf_conntrack_helper.c netfilter: nf_conntrack: use is_vmalloc_addr() 2011-01-14 15:45:56 +01:00
nf_conntrack_irc.c
nf_conntrack_l3proto_generic.c
nf_conntrack_netbios_ns.c netfilter: nf_conntrack: nf_conntrack snmp helper 2011-01-18 18:12:24 +01:00
nf_conntrack_netlink.c netfilter: ctnetlink: fix ctnetlink_parse_tuple() warning 2011-02-01 17:26:37 +01:00
nf_conntrack_pptp.c
nf_conntrack_proto_dccp.c netfilter: nf_conntrack: don't always initialize ct->proto 2010-11-12 17:33:17 +01:00
nf_conntrack_proto_generic.c
nf_conntrack_proto_gre.c
nf_conntrack_proto_sctp.c netfilter: nf_conntrack: don't always initialize ct->proto 2010-11-12 17:33:17 +01:00
nf_conntrack_proto_tcp.c netfilter: nf_ct_tcp: fix out of sync scenario while in SYN_RECV 2011-02-28 18:02:33 +01:00
nf_conntrack_proto_udp.c
nf_conntrack_proto_udplite.c
nf_conntrack_proto.c netfilter: rcu sparse cleanups 2010-11-15 19:45:13 +01:00
nf_conntrack_sane.c
nf_conntrack_sip.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-next-2.6 2010-10-21 08:21:34 -07:00
nf_conntrack_snmp.c netfilter: nf_conntrack: nf_conntrack snmp helper 2011-01-18 18:12:24 +01:00
nf_conntrack_standalone.c netfilter: nf_conntrack: fix lifetime display for disabled connections 2011-01-19 19:10:49 +01:00
nf_conntrack_tftp.c
nf_conntrack_timestamp.c netfilter: nf_conntrack_tstamp: add flow-based timestamp extension 2011-01-19 16:00:07 +01:00
nf_internals.h
nf_log.c netfilter: add __rcu annotations 2010-11-15 18:17:21 +01:00
nf_queue.c netfilter: allow NFQUEUE bypass if no listener is available 2011-01-18 16:08:30 +01:00
nf_sockopt.c
nf_tproxy_core.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-next-2.6 2010-10-21 08:21:34 -07:00
nfnetlink_log.c netfilter: nfnetlink_log: remove unused parameter 2011-02-15 21:59:37 +01:00
nfnetlink_queue.c netfilter: nfnetlink_queue: return error number to caller 2011-01-18 15:27:28 +01:00
nfnetlink.c
x_tables.c Merge branch 'master' of /repos/git/net-next-2.6 2011-01-19 23:51:37 +01:00
xt_AUDIT.c netfilter: audit target to record accepted/dropped packets 2011-01-16 18:10:28 +01:00
xt_CHECKSUM.c
xt_CLASSIFY.c netfilter: xt_CLASSIFY: add ARP support, allow CLASSIFY target on any table 2010-11-15 13:57:56 +01:00
xt_cluster.c
xt_comment.c
xt_connbytes.c
xt_connlimit.c Revert "netfilter: xt_connlimit: connlimit-above early loop termination" 2011-02-14 16:54:33 +01:00
xt_connmark.c
xt_CONNSECMARK.c
xt_conntrack.c netfilter: xt_conntrack: warn about use in raw table 2011-02-14 17:28:55 +01:00
xt_cpu.c netfilter: xtables: add missing aliases for autoloading via iptables 2011-01-18 06:33:54 +01:00
xt_CT.c secmark: make secmark object handling generic 2010-10-21 10:12:48 +11:00
xt_dccp.c
xt_devgroup.c netfilter: xtables: add device group match 2011-02-03 00:05:43 +01:00
xt_dscp.c
xt_DSCP.c
xt_esp.c
xt_hashlimit.c
xt_helper.c
xt_hl.c
xt_HL.c
xt_IDLETIMER.c netfilter: xtables: add missing aliases for autoloading via iptables 2011-01-18 06:33:54 +01:00
xt_iprange.c netfilter: xt_iprange: add IPv6 match debug print code 2011-01-28 19:33:13 +01:00
xt_ipvs.c IPVS: netns, use ip_vs_proto_data as param. 2011-01-13 10:30:27 +09:00
xt_LED.c netfilter: xtables: add missing aliases for autoloading via iptables 2011-01-18 06:33:54 +01:00
xt_length.c
xt_limit.c
xt_mac.c
xt_mark.c
xt_multiport.c
xt_NFLOG.c
xt_NFQUEUE.c netfilter: allow NFQUEUE bypass if no listener is available 2011-01-18 16:08:30 +01:00
xt_NOTRACK.c
xt_osf.c
xt_owner.c
xt_physdev.c
xt_pkttype.c
xt_policy.c
xt_quota.c
xt_rateest.c
xt_RATEEST.c
xt_realm.c
xt_recent.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
xt_repldata.h
xt_sctp.c
xt_SECMARK.c secmark: make secmark object handling generic 2010-10-21 10:12:48 +11:00
xt_set.c netfilter: xtables: "set" match and "SET" target support 2011-02-01 15:56:00 +01:00
xt_socket.c netfilter: xt_socket: Make tproto signed in socket_mt6_v1(). 2010-10-28 12:59:53 -07:00
xt_state.c
xt_statistic.c
xt_string.c
xt_tcpmss.c
xt_TCPMSS.c
xt_TCPOPTSTRIP.c
xt_tcpudp.c
xt_TEE.c net: use the macros defined for the members of flowi 2010-11-17 12:27:45 -08:00
xt_time.c
xt_TPROXY.c netfilter: fix module dependency issues with IPv6 defragmentation, ip6tables and xt_TPROXY 2010-10-25 13:58:36 -07:00
xt_TRACE.c
xt_u32.c