https://github.com/cilium/cilium
Revision 3a93b00269b1fb762b2c9f98ab67a6ed3a333dda authored by Gray Liang on 23 October 2023, 03:13:25 UTC, committed by Julian Wiedmann on 01 December 2023, 16:20:14 UTC
Previously we set skb->mark in from_host@cilium_host, expect the mark
to remain unchanged after kernel transmits skb from cilium_host to
cilium_net. The skb->mark is for instance used to transport
IPsec-related information.

However, as of 2023-10-19, kernel 5.10 still misses the backport patch[1]
to fix a bug in skb_scrub_packet() which clears skb->mark for veth_xmit even if the
veth pair is under the same netns:
https://elixir.bootlin.com/linux/v5.10.198/source/include/linux/netdevice.h#L3975

To avoid hitting this issue, this patch sets metadata in skb->cb to
survive skb_scrub_packet(), then to_host@cilium_net can retrieve this
info and set proper mark.

Only from_host bpf is setting cb, while from_lxc bpf is still using mark.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ff70202b2d1a ("dev_forward_skb: do not scrub skb mark within the same name space")

Signed-off-by: Zhichuan Liang <gray.liang@isovalent.com>
1 parent e78ff16
History
Tip revision: 3a93b00269b1fb762b2c9f98ab67a6ed3a333dda authored by Gray Liang on 23 October 2023, 03:13:25 UTC
bpf: work around scrubbing of skb->mark during veth transition
Tip revision: 3a93b00
File Mode Size
.devcontainer
.github
.nvim
.travis
.vscode
Documentation
api
bpf
bugtool
cilium-dbg
cilium-health
clustermesh-apiserver
contrib
daemon
examples
hack
hubble-relay
images
install
operator
pkg
plugins
test
tools
vendor
.authors.aux -rw-r--r-- 416 bytes
.clang-format -rw-r--r-- 7.6 KB
.clomonitor.yml -rw-r--r-- 984 bytes
.gitattributes -rw-r--r-- 887 bytes
.gitignore -rw-r--r-- 1.8 KB
.golangci.yaml -rw-r--r-- 4.1 KB
.mailmap -rw-r--r-- 6.4 KB
.travis.yml -rw-r--r-- 506 bytes
AUTHORS -rw-r--r-- 45.7 KB
CODEOWNERS -rw-r--r-- 26.1 KB
CODE_OF_CONDUCT.md -rw-r--r-- 2.2 KB
CONTRIBUTING.md -rw-r--r-- 691 bytes
FURTHER_READINGS.rst -rw-r--r-- 6.4 KB
LICENSE -rw-r--r-- 11.1 KB
MAINTAINERS.md -rw-r--r-- 4.5 KB
Makefile -rw-r--r-- 40.6 KB
Makefile.defs -rw-r--r-- 7.1 KB
Makefile.docker -rw-r--r-- 7.1 KB
Makefile.quiet -rw-r--r-- 818 bytes
README.rst -rw-r--r-- 19.6 KB
SECURITY.md -rw-r--r-- 1.0 KB
USERS.md -rw-r--r-- 31.7 KB
VERSION -rw-r--r-- 11 bytes
Vagrantfile -rw-r--r-- 14.9 KB
go.mod -rw-r--r-- 12.6 KB
go.sum -rw-r--r-- 125.5 KB
netlify.toml -rw-r--r-- 92 bytes
stable.txt -rw-r--r-- 8 bytes
vagrant_box_defaults.rb -rw-r--r-- 334 bytes

README.rst

back to top