History

netfilter: conntrack: udp: only extend timeout to stream mode after 2s

Currently DNS resolvers that send both A and AAAA queries from same source port can trigger stream mode prematurely, which results in non-early-evictable conntrack entry for three minutes, even though DNS requests are done in a few milliseconds. Add a two second grace period where we continue to use the ordinary 30-second default timeout. Its enough for DNS request/response traffic, even if two request/reply packets are involved. ASSURED is still set, else conntrack (and thus a possible NAT mapping ...) gets zapped too in case conntrack table runs full.

Florian Westphal committed 7 years ago

Commit d535c8a1 parent 06aa1512 files · +18 −3Browse files

Showing the changes to include/net (1 of 2 files). Show all

Unified · Split

include/net/netfilter/nf_conntrack.h+5−0
@@ -27,12 +27,17 @@ · 26 unmodified lines
2727
2828 #include <net/netfilter/nf_conntrack_tuple.h>
2929
30+struct nf_ct_udp {
31+ unsigned long stream_ts;
32+};
33+
3034 /* per conntrack: protocol private data */
3135 union nf_conntrack_proto {
3236 /* insert conntrack proto private data here */
3337 struct nf_ct_dccp dccp;
3438 struct ip_ct_sctp sctp;
3539 struct ip_ct_tcp tcp;
40+ struct nf_ct_udp udp;
3641 struct nf_ct_gre gre;
3742 unsigned int tmpl_padto;
3843 };