]> git.baikalelectronics.ru Git - kernel.git/commit
seg6: bpf: fix skb checksum in bpf_push_seg6_encap()
authorAndrea Mayer <andrea.mayer@uniroma2.it>
Tue, 12 Jul 2022 17:58:37 +0000 (19:58 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 21 Jul 2022 18:59:23 +0000 (20:59 +0200)
commitefe1e1402b54aa402a86d655a821dda66b1602b1
tree14d5a72fc519bc0e0c817098814936f025c3535d
parentaeff1f60b036b700d65c1a3d57b0b8ba610984fb
seg6: bpf: fix skb checksum in bpf_push_seg6_encap()

[ Upstream commit 9c02285b654da215acd7d148809fc3c5efac70e0 ]

Both helper functions bpf_lwt_seg6_action() and bpf_lwt_push_encap() use
the bpf_push_seg6_encap() to encapsulate the packet in an IPv6 with Segment
Routing Header (SRH) or insert an SRH between the IPv6 header and the
payload.
To achieve this result, such helper functions rely on bpf_push_seg6_encap()
which, in turn, leverages seg6_do_srh_{encap,inline}() to perform the
required operation (i.e. encap/inline).

This patch removes the initialization of the IPv6 header payload length
from bpf_push_seg6_encap(), as it is now handled properly by
seg6_do_srh_{encap,inline}() to prevent corruption of the skb checksum.

Fixes: 6c213df3e791 ("bpf: Add IPv6 Segment Routing helpers")
Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/core/filter.c