Skip to content

pkg/datapath: require scrub attributes with netkit and endpoint routes#44960

Merged
julianwiedmann merged 1 commit intocilium:mainfrom
ajmmm:pr/netkit-scrub-endpoint-routes
Mar 25, 2026
Merged

pkg/datapath: require scrub attributes with netkit and endpoint routes#44960
julianwiedmann merged 1 commit intocilium:mainfrom
ajmmm:pr/netkit-scrub-endpoint-routes

Conversation

@ajmmm
Copy link
Copy Markdown
Member

@ajmmm ajmmm commented Mar 23, 2026

Early versions of the netkit driver scrubbed skb metadata before BPF programs are run, meaning identity metadata is not available in BPF. This can cause network policy mis-classification if per-endpoint routes are enabled.

A kernel patch landed in the driver [0] which adds new scrub attributes to manage this, and a subsequent change was made in the Cilium datapath connector [1] to make use of these new attributes. However, it's still possible to run Cilium with netkit on a kernel that doesn't support them, which is confusing [2] and may still result in strange behavior.

This commit introduces a runtime probe that will actively probe the underlying host for netkit scrub attributes, if running with per-endpoint routes. If the probe fails, we error out.

  • With bpf.datapathMode={netkit,netkit-l2} this will error and the agent will fail to start.

  • with bpf.datapathMode=auto, this will log a warning and fall-back to veth connector.

This commit also introduces additional test permutations to cover this.

[0] https://lore.kernel.org/bpf/20241004101335.117711-1-daniel@iogearbox.net
[1] #35306
[2] #40021

Do not run with netkit and per-endpoint routes if kernel does not support netkit scrub attributes.

@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Mar 23, 2026
@ajmmm
Copy link
Copy Markdown
Member Author

ajmmm commented Mar 23, 2026

/test

@ajmmm ajmmm force-pushed the pr/netkit-scrub-endpoint-routes branch from 9255066 to 2ed24e1 Compare March 23, 2026 11:24
@ajmmm ajmmm marked this pull request as ready for review March 23, 2026 11:25
@ajmmm ajmmm requested review from a team as code owners March 23, 2026 11:25
@ajmmm ajmmm requested review from aspsk and rgo3 March 23, 2026 11:25
@ajmmm
Copy link
Copy Markdown
Member Author

ajmmm commented Mar 23, 2026

/test

1 similar comment
@cilium-ariane
Copy link
Copy Markdown

cilium-ariane bot commented Mar 23, 2026

/test

Early versions of the netkit driver scrubbed skb metadata before BPF
programs are run, meaning identity metadata is not available in BPF.
This can cause network policy mis-classification if per-endpoint routes
are enabled.

A kernel patch landed in the driver [0] which adds new scrub attributes
to manage this, and a subsequent change was made in the Cilium datapath
connector [1] to make use of these new attributes. However, it's still
possible to run Cilium with netkit on a kernel that doesn't support
them, which is confusing [2] and may still result in strange behavior.

This commit introduces a runtime probe that will actively probe the
underlying host for netkit scrub attributes, if running with per-endpoint
routes. If the probe fails, we error out.

- With bpf.datapathMode={netkit,netkit-l2} this will error and the agent
  will fail to start.

- with bpf.datapathMode=auto, this will log a warning and fall-back to
  veth connector.

This commit also introduces additional test permutations to cover this.

[0] https://lore.kernel.org/bpf/20241004101335.117711-1-daniel@iogearbox.net
[1] cilium#35306
[2] cilium#40021

Signed-off-by: Alasdair McWilliam <alasdair.mcwilliam@isovalent.com>
@ajmmm ajmmm force-pushed the pr/netkit-scrub-endpoint-routes branch from 2ed24e1 to a022866 Compare March 23, 2026 12:40
@ajmmm
Copy link
Copy Markdown
Member Author

ajmmm commented Mar 23, 2026

/test

1 similar comment
@cilium-ariane
Copy link
Copy Markdown

cilium-ariane bot commented Mar 23, 2026

/test

Copy link
Copy Markdown
Contributor

@rgo3 rgo3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loader LGTM, thanks!

Copy link
Copy Markdown
Contributor

@aspsk aspsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@julianwiedmann julianwiedmann added area/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages. release-note/minor This PR changes functionality that users may find relevant to operating Cilium. feature/netkit labels Mar 25, 2026
@maintainer-s-little-helper maintainer-s-little-helper bot added ready-to-merge This PR has passed all tests and received consensus from code owners to merge. and removed dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. labels Mar 25, 2026
@julianwiedmann julianwiedmann added this pull request to the merge queue Mar 25, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 25, 2026
@julianwiedmann julianwiedmann added this pull request to the merge queue Mar 25, 2026
Merged via the queue into cilium:main with commit 700a878 Mar 25, 2026
76 of 79 checks passed
@ajmmm ajmmm deleted the pr/netkit-scrub-endpoint-routes branch March 25, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages. feature/netkit ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/minor This PR changes functionality that users may find relevant to operating Cilium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants