Files
kernel_google_wahoo/include/linux
Martin KaFai Lau d71b209acf bpf: Fix bpf_redirect to an ipip/ip6tnl dev
If the bpf program calls bpf_redirect(dev, 0) and dev is
an ipip/ip6tnl, it currently includes the mac header.
e.g. If dev is ipip, the end result is IP-EthHdr-IP instead
of IP-IP.

The fix is to pull the mac header.  At ingress, skb_postpull_rcsum()
is not needed because the ethhdr should have been pulled once already
and then got pushed back just before calling the bpf_prog.
At egress, this patch calls skb_postpull_rcsum().

If bpf_redirect(dev, BPF_F_INGRESS) is called,
it also fails now because it calls dev_forward_skb() which
eventually calls eth_type_trans(skb, dev).  The eth_type_trans()
will set skb->type = PACKET_OTHERHOST because the mac address
does not match the redirecting dev->dev_addr.  The PACKET_OTHERHOST
will eventually cause the ip_rcv() errors out.  To fix this,
____dev_forward_skb() is added.

Joint work with Daniel Borkmann.

Fixes: cfc7381b3002 ("ip_tunnel: add collect_md mode to IPIP tunnel")
Fixes: 8d79266bc48c ("ip6_tunnel: add collect_md mode to IPv6 tunnels")
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@fb.com>
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-03-04 20:17:01 +01:00
..
2018-04-08 11:51:57 +02:00
2017-05-22 23:19:33 -07:00
2017-07-15 11:57:44 +02:00
2018-04-12 09:58:05 -07:00
2021-02-03 23:16:16 +01:00
2021-12-14 10:35:51 +01:00
2017-01-23 11:03:24 +05:30
2022-03-04 20:16:57 +01:00
2017-05-04 16:43:06 +00:00
2021-11-26 11:58:33 +01:00
2020-08-26 07:32:20 -07:00
2022-03-04 20:16:44 +01:00
2017-08-24 17:02:36 -07:00
2019-04-03 10:24:12 +02:00
2019-01-11 07:53:18 +09:00
2020-04-02 19:02:39 +02:00
2021-03-07 11:37:45 +01:00
2018-11-21 09:27:36 +01:00
2019-12-21 11:36:50 +01:00
2020-12-14 00:49:15 -07:00
2020-09-23 21:48:05 -07:00
2020-04-02 19:02:39 +02:00
2021-12-14 10:03:49 +01:00
2018-08-23 12:00:19 -07:00
2018-08-23 12:00:19 -07:00