WSL2-Linux-Kernel/net/ipv4/netfilter
Daniel Hokka Zakrisson d0ebf13359 [NETFILTER]: ipt_recent: sanity check hit count
If a rule using ipt_recent is created with a hit count greater than
ip_pkt_list_tot, the rule will never match as it cannot keep track
of enough timestamps. This patch makes ipt_recent refuse to create such
rules.

With ip_pkt_list_tot's default value of 20, the following can be used
to reproduce the problem.

nc -u -l 0.0.0.0 1234 &
for i in `seq 1 100`; do echo $i | nc -w 1 -u 127.0.0.1 1234; done

This limits it to 20 packets:
iptables -A OUTPUT -p udp --dport 1234 -m recent --set --name test \
         --rsource
iptables -A OUTPUT -p udp --dport 1234 -m recent --update --seconds \
         60 --hitcount 20 --name test --rsource -j DROP

While this is unlimited:
iptables -A OUTPUT -p udp --dport 1234 -m recent --set --name test \
         --rsource
iptables -A OUTPUT -p udp --dport 1234 -m recent --update --seconds \
         60 --hitcount 21 --name test --rsource -j DROP

With the patch the second rule-set will throw an EINVAL.

Reported-by: Sean Kennedy <skennedy@vcn.com>
Signed-off-by: Daniel Hokka Zakrisson <daniel@hozac.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-03-20 15:07:10 -07:00
..
Kconfig [NETFILTER]: Rename ipt_iprange to xt_iprange 2008-01-28 15:02:27 -08:00
Makefile [NETFILTER]: Rename ipt_iprange to xt_iprange 2008-01-28 15:02:27 -08:00
arp_tables.c [NETFILTER]: x_tables: create per-netns /proc/net/*_tables_* 2008-01-31 19:28:06 -08:00
arpt_mangle.c [NETFILTER]: Fix incorrect use of skb_make_writable 2008-02-19 17:18:47 -08:00
arptable_filter.c [NETFILTER]: arp_tables: per-netns arp_tables FILTER 2008-01-31 19:27:41 -08:00
ip_queue.c [NETFILTER]: {ip,ip6,nfnetlink}_queue: fix SKB_LINEAR_ASSERT when mangling packet data 2008-02-19 17:17:52 -08:00
ip_tables.c [NETFILTER]: x_tables: create per-netns /proc/net/*_tables_* 2008-01-31 19:28:06 -08:00
ipt_CLUSTERIP.c [NETFILTER]: ipt_CLUSTERIP: kill clusterip_config_entry_get 2008-01-31 19:28:02 -08:00
ipt_ECN.c [NETFILTER]: Update modules' descriptions 2008-01-28 15:02:26 -08:00
ipt_LOG.c [NETFILTER]: Update modules' descriptions 2008-01-28 15:02:26 -08:00
ipt_MASQUERADE.c [NETFILTER]: Update modules' descriptions 2008-01-28 15:02:26 -08:00
ipt_NETMAP.c [NETFILTER]: Update modules' descriptions 2008-01-28 15:02:26 -08:00
ipt_REDIRECT.c [NETFILTER]: Update modules' descriptions 2008-01-28 15:02:26 -08:00
ipt_REJECT.c [NETFILTER]: ipt_REJECT: properly handle IP options 2008-01-28 15:02:30 -08:00
ipt_TTL.c [NETFILTER]: Update modules' descriptions 2008-01-28 15:02:26 -08:00
ipt_ULOG.c [NETNS]: Consolidate kernel netlink socket destruction. 2008-01-28 15:08:07 -08:00
ipt_addrtype.c [NETFILTER]: Update modules' descriptions 2008-01-28 15:02:26 -08:00
ipt_ah.c [NETFILTER]: Update modules' descriptions 2008-01-28 15:02:26 -08:00
ipt_ecn.c [NETFILTER]: Update modules' descriptions 2008-01-28 15:02:26 -08:00
ipt_recent.c [NETFILTER]: ipt_recent: sanity check hit count 2008-03-20 15:07:10 -07:00
ipt_ttl.c [NETFILTER]: Update modules' descriptions 2008-01-28 15:02:26 -08:00
iptable_filter.c [NETFILTER]: ip_tables: per-netns FILTER, MANGLE, RAW 2008-01-31 19:27:38 -08:00
iptable_mangle.c [NETFILTER]: ip_tables: per-netns FILTER, MANGLE, RAW 2008-01-31 19:27:38 -08:00
iptable_raw.c [NETFILTER]: ip_tables: per-netns FILTER, MANGLE, RAW 2008-01-31 19:27:38 -08:00
nf_conntrack_l3proto_ipv4.c [NETFILTER]: nf_conntrack: annotate l3protos with const 2008-01-31 19:28:13 -08:00
nf_conntrack_l3proto_ipv4_compat.c [NETFILTER]: nf_conntrack: annotate l3protos with const 2008-01-31 19:28:13 -08:00
nf_conntrack_proto_icmp.c [NETFILTER]: nf_{conntrack,nat}_icmp: constify and annotate 2008-01-31 19:28:12 -08:00
nf_nat_amanda.c [NETFILTER]: remove unneeded rcu_dereference() calls 2007-11-07 04:08:23 -08:00
nf_nat_core.c [NETFILTER]: nf_conntrack: fix ct_extend ->move operation 2008-02-07 17:56:34 -08:00
nf_nat_ftp.c [NETFILTER]: remove unneeded rcu_dereference() calls 2007-11-07 04:08:23 -08:00
nf_nat_h323.c [NETFILTER]: nf_conntrack_h323: constify and annotate H.323 helper 2008-01-31 19:28:07 -08:00
nf_nat_helper.c [NETFILTER]: nf_nat: fix sparse warning 2008-01-31 19:28:15 -08:00
nf_nat_irc.c [NETFILTER]: remove unneeded rcu_dereference() calls 2007-11-07 04:08:23 -08:00
nf_nat_pptp.c [NETFILTER]: nf_{conntrack,nat}_pptp: annotate PPtP helper with const 2008-01-31 19:28:09 -08:00
nf_nat_proto_gre.c [NETFILTER]: nf_{conntrack,nat}_proto_gre: annotate with const 2008-01-31 19:28:12 -08:00
nf_nat_proto_icmp.c [NETFILTER]: nf_{conntrack,nat}_icmp: constify and annotate 2008-01-31 19:28:12 -08:00
nf_nat_proto_tcp.c [NETFILTER]: nf_{conntrack,nat}_proto_tcp: constify and annotate TCP modules 2008-01-31 19:28:10 -08:00
nf_nat_proto_udp.c [NETFILTER]: nf_{conntrack,nat}_proto_udp{,lite}: annotate with const 2008-01-31 19:28:11 -08:00
nf_nat_proto_unknown.c [NETFILTER]: nf_nat: mark NAT protocols const 2008-01-28 14:58:56 -08:00
nf_nat_rule.c [NETFILTER]: x_tables: return new table from {arp,ip,ip6}t_register_table() 2008-01-31 19:27:36 -08:00
nf_nat_sip.c [NETFILTER]: nf_{conntrack,nat}_sip: annotate SIP helper with const 2008-01-31 19:28:08 -08:00
nf_nat_snmp_basic.c [NETFILTER]: nf_nat_snmp: sparse warning 2008-01-31 19:27:44 -08:00
nf_nat_standalone.c [NETFILTER]: nf_nat: properly use RCU for ip_nat_decode_session 2008-01-28 14:59:06 -08:00
nf_nat_tftp.c [NETFILTER]: nf_{conntrack,nat}_tftp: annotate TFTP helper with const 2008-01-31 19:28:08 -08:00