]> git.baikalelectronics.ru Git - kernel.git/commit
net: ipv4: do not handle duplicate fragments as overlapping
authorMichal Kubecek <mkubecek@suse.cz>
Thu, 13 Dec 2018 16:23:32 +0000 (17:23 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 15 Dec 2018 19:50:40 +0000 (11:50 -0800)
commitf94591fde8b9133e8241c5e8240dda8d222b17e4
tree7d620a23e1b498955b8bfbbdaad227a28ed9eeb8
parentfc116e90dcbd1e60fcad01cea26c93ef398bb2f4
net: ipv4: do not handle duplicate fragments as overlapping

Since commit 1d918cea79d5 ("ip: discard IPv4 datagrams with overlapping
segments.") IPv4 reassembly code drops the whole queue whenever an
overlapping fragment is received. However, the test is written in a way
which detects duplicate fragments as overlapping so that in environments
with many duplicate packets, fragmented packets may be undeliverable.

Add an extra test and for (potentially) duplicate fragment, only drop the
new fragment rather than the whole queue. Only starting offset and length
are checked, not the contents of the fragments as that would be too
expensive. For similar reason, linear list ("run") of a rbtree node is not
iterated, we only check if the new fragment is a subset of the interval
covered by existing consecutive fragments.

v2: instead of an exact check iterating through linear list of an rbtree
node, only check if the new fragment is subset of the "run" (suggested
by Eric Dumazet)

Fixes: 1d918cea79d5 ("ip: discard IPv4 datagrams with overlapping segments.")
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ip_fragment.c