net: disable fragment reassembly if high_thresh is set to zero
authorMichal Kubecek <mkubecek@suse.cz>
Mon, 9 May 2016 09:01:04 +0000 (11:01 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 10 Feb 2017 10:03:48 +0000 (11:03 +0100)
commit5a0b77dcdb3baf1d076864289098683e6a9d96f9
treef51f75d712f15d24efb145fe651e6be6eb5eeb21
parenteec89a779ca280a068c97ce2309961ebe83c2ce3
net: disable fragment reassembly if high_thresh is set to zero

commit 30759219f562cfaaebe7b9c1d1c0e6b5445c69b0 upstream.

Before commit 6d7b857d541e ("net: use lib/percpu_counter API for
fragmentation mem accounting"), setting high threshold to 0 prevented
fragment reassembly as first fragment would be always evicted before
second could be added to the queue. While inefficient, some users
apparently relied on it.

Since the commit mentioned above, a percpu counter is used for
reassembly memory accounting and high batch size avoids taking slow path
in most common scenarios. As a result, a whole full sized packet can be
reassembled without the percpu counter's main counter changing its
value so that even with high_thresh set to 0, fragmented packets can be
still reassembled and processed.

Add explicit checks preventing reassembly if high threshold is zero.

[mk] backport to 3.12

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Willy Tarreau <w@1wt.eu>
net/ipv4/ip_fragment.c
net/ipv6/netfilter/nf_conntrack_reasm.c
net/ipv6/reassembly.c