summaryrefslogtreecommitdiff
path: root/scripts/basic/split-include.c
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2026-11-01 19:05:29 +0000
committerAlexei Starovoitov <ast@kernel.org>2026-11-02 00:10:40 +0000
commit701ffd202b9e32942c8cfc065c9fe76ceaccc302 (patch)
treedbea5249480017b76ed5af0044c5f2db022a2d1b /scripts/basic/split-include.c
parent0fcb3f11a93d740e7f9ae1aeb48fe4d25838be18 (diff)
downloadlinux-701ffd202b9e32942c8cfc065c9fe76ceaccc302.tar.gz
linux-701ffd202b9e32942c8cfc065c9fe76ceaccc302.zip
bpf: Don't leave a stale MAC header in bpf_lwt_push_ip_encap()
With BPF_LWT_ENCAP_IP, bpf_lwt_push_encap() pushes a new IP header. The new header overwrites the MAC header of a received skb. But skb->mac_header continues to point to the same bytes. Code that reads the MAC header after the push, for example netfilter, gets bytes of the new header. before the push | MAC header | old IP | payload ^ mac_header ^ network_header today | new header | old IP | payload network_header ^ ^ mac_header this patch, lwt_in | MAC header | new header | old IP | payload ^ mac_header ^ network_header this patch, lwt_xmit | new header | old IP | payload network_header ^ mac_header is not set For lwt_in, move the MAC header in front of the new header before the memcpy(), as __seg6_do_srh_encap() does. skb_cow_head() already reserves len + skb->mac_len bytes. For lwt_xmit, the output path makes a new MAC header. Thus mark skb->mac_header as not set. This is the state of a locally generated skb. Fixes: 52f278774e79 ("bpf: implement BPF_LWT_ENCAP_IP mode in bpf_lwt_push_encap") Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20261101190535.1454146-22-alexei.starovoitov@gmail.com
Diffstat (limited to 'scripts/basic/split-include.c')
0 files changed, 0 insertions, 0 deletions