]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: nat: fix ICMP header corruption on ICMP errors
authorEyal Birger <eyal.birger@gmail.com>
Tue, 14 Jan 2020 08:03:50 +0000 (10:03 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 16 Jan 2020 14:08:25 +0000 (15:08 +0100)
commit8ab92895d6381a80d511c0b83e17f7888bf57f47
tree8ea08f4c27ddc1e25d3ec0a0f0602436efe68a61
parent70923a060848319449d2390997281526d7c251b8
netfilter: nat: fix ICMP header corruption on ICMP errors

Commit 00c870e276c6 ("netfilter: nat: fix spurious connection timeouts")
made nf_nat_icmp_reply_translation() use icmp_manip_pkt() as the l4
manipulation function for the outer packet on ICMP errors.

However, icmp_manip_pkt() assumes the packet has an 'id' field which
is not correct for all types of ICMP messages.

This is not correct for ICMP error packets, and leads to bogus bytes
being written the ICMP header, which can be wrongfully regarded as
'length' bytes by RFC 4884 compliant receivers.

Fix by assigning the 'id' field only for ICMP messages that have this
semantic.

Reported-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Fixes: 00c870e276c6 ("netfilter: nat: fix spurious connection timeouts")
Signed-off-by: Eyal Birger <eyal.birger@gmail.com>
Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_nat_proto.c