netfilter: nf_log: incorrect offset to network header
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 5 Jul 2022 08:26:15 +0000 (10:26 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 21 Jul 2022 19:24:23 +0000 (21:24 +0200)
commitb97aa619a3cbe334d52843e728e9c1b25c0f6794
tree7182b5dc0353fe982d28606520ed95c7c3ae0ff9
parentdc2ec80bc949d3fdb4b4c6b848e7e25a2758272f
netfilter: nf_log: incorrect offset to network header

[ Upstream commit 7a847c00eeba9744353ecdfad253143b9115678a ]

NFPROTO_ARP is expecting to find the ARP header at the network offset.

In the particular case of ARP, HTYPE= field shows the initial bytes of
the ethernet header destination MAC address.

 netdev out: IN= OUT=bridge0 MACSRC=c2:76:e5:71:e1:de MACDST=36:b0:4a:e2:72:ea MACPROTO=0806 ARP HTYPE=14000 PTYPE=0x4ae2 OPCODE=49782

NFPROTO_NETDEV egress hook is also expecting to find the IP headers at
the network offset.

Fixes: 35b9395104d5 ("netfilter: add generic ARP packet logger")
Reported-by: Tom Yan <tom.ty89@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/netfilter/nf_log_syslog.c