batman-adv: Merge bugfixes from 2018.0
[feed/routing.git] / batman-adv / patches / 0024-batman-adv-fix-packet-checksum-in-receive-path.patch
1 From: Matthias Schiffer <mschiffer@universe-factory.net>
2 Date: Tue, 23 Jan 2018 10:59:49 +0100
3 Subject: [PATCH] batman-adv: fix packet checksum in receive path
4
5 eth_type_trans() internally calls skb_pull(), which does not adjust the
6 skb checksum; skb_postpull_rcsum() is necessary to avoid log spam of the
7 form "bat0: hw csum failure" when packets with CHECKSUM_COMPLETE are
8 received.
9
10 Note that in usual setups, packets don't reach batman-adv with
11 CHECKSUM_COMPLETE (I assume NICs bail out of checksumming when they see
12 batadv's ethtype?), which is why the log messages do not occur on every
13 system using batman-adv. I could reproduce this issue by stacking
14 batman-adv on top of a VXLAN interface.
15
16 Fixes: fe28a94c01e1 ("batman-adv: receive packets directly using skbs")
17 Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
18 Signed-off-by: Sven Eckelmann <sven@narfation.org>
19
20 Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/798174b15153afd88268f2f87811602f68b3f2c6
21 ---
22 net/batman-adv/soft-interface.c | 8 +-------
23 1 file changed, 1 insertion(+), 7 deletions(-)
24
25 diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
26 index 08432b14386a53c771c54b9eb38893d94c6f9b53..5da1a1c0f1efb5d95f31bc852b899f61e462feb1 100644
27 --- a/net/batman-adv/soft-interface.c
28 +++ b/net/batman-adv/soft-interface.c
29 @@ -470,13 +470,7 @@ void batadv_interface_rx(struct net_device *soft_iface,
30
31 /* skb->dev & skb->pkt_type are set here */
32 skb->protocol = eth_type_trans(skb, soft_iface);
33 -
34 - /* should not be necessary anymore as we use skb_pull_rcsum()
35 - * TODO: please verify this and remove this TODO
36 - * -- Dec 21st 2009, Simon Wunderlich
37 - */
38 -
39 - /* skb->ip_summed = CHECKSUM_UNNECESSARY; */
40 + skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
41
42 batadv_inc_counter(bat_priv, BATADV_CNT_RX);
43 batadv_add_counter(bat_priv, BATADV_CNT_RX_BYTES,