]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commit
xfrm interface: fix packet tx through bpf_redirect()
authorNicolas Dichtel <nicolas.dichtel@6wind.com>
Wed, 12 Feb 2020 18:07:00 +0000 (19:07 +0100)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Fri, 14 Feb 2020 12:44:21 +0000 (13:44 +0100)
commite103a67c6b5f73e4a490cd93edb98b6ee93719b6
tree776d15a27bc4950ac97147209194815e3c375d5c
parentb15dcd9e7b129dda25807e7a23962744dfeaf73d
xfrm interface: fix packet tx through bpf_redirect()

BugLink: https://bugs.launchpad.net/bugs/1860969
With an ebpf program that redirects packets through a xfrm interface,
packets are dropped because no dst is attached to skb.

This could also be reproduced with an AF_PACKET socket, with the following
python script (xfrm1 is a xfrm interface):

 import socket
 send_s = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, 0)
 # scapy
 # p = IP(src='10.100.0.2', dst='10.200.0.1')/ICMP(type='echo-request')
 # raw(p)
 req = b'E\x00\x00\x1c\x00\x01\x00\x00@\x01e\xb2\nd\x00\x02\n\xc8\x00\x01\x08\x00\xf7\xff\x00\x00\x00\x00'
 send_s.sendto(req, ('xfrm1', 0x800, 0, 0))

It was also not possible to send an ip packet through an AF_PACKET socket
because a LL header was expected. Let's remove those LL header constraints.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
(cherry picked from commit f042365dbffea98fb8148c98c700402e8d099f02)
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
Acked-by: Kamal Mostafa <kamal@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
net/xfrm/xfrm_interface.c