Skip to content

bpf:tests:encrypt_host: extend suite with Overlay coverage#45084

Open
smagnani96 wants to merge 1 commit intomainfrom
pr/smagnani96/encrypt-host-test-overlay
Open

bpf:tests:encrypt_host: extend suite with Overlay coverage#45084
smagnani96 wants to merge 1 commit intomainfrom
pr/smagnani96/encrypt-host-test-overlay

Conversation

@smagnani96
Copy link
Copy Markdown
Contributor

Follow-up of #44339.

@smagnani96 smagnani96 self-assigned this Mar 31, 2026
@smagnani96 smagnani96 added kind/enhancement This would improve or streamline existing functionality. area/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages. area/encryption Impacts encryption support such as IPSec, WireGuard, or kTLS. release-note/ci This PR makes changes to the CI. dont-merge/blocked Another PR must be merged before this one. feature/ipsec Relates to Cilium's IPsec feature feature/wireguard Relates to Cilium's Wireguard feature labels Mar 31, 2026
@julianwiedmann julianwiedmann self-requested a review April 1, 2026 03:12
Base automatically changed from pr/smagnani96/wg-test-fix to main April 1, 2026 03:23
This commit extends the encrypt_host test suite with new tests for
encryption with Overlay encapsulation, both for WireGuard and IPsec.

Signed-off-by: Simone Magnani <simone.magnani@isovalent.com>
@smagnani96 smagnani96 force-pushed the pr/smagnani96/encrypt-host-test-overlay branch from 88cd086 to 02717e1 Compare April 1, 2026 10:32
@smagnani96
Copy link
Copy Markdown
Contributor Author

/test

@smagnani96 smagnani96 marked this pull request as ready for review April 1, 2026 13:56
@smagnani96 smagnani96 requested a review from a team as a code owner April 1, 2026 13:56
Comment on lines +155 to +170
#ifndef TUNNEL_MODE
ipcache_v4_add_entry_with_mask_size(DST_POD_CIDR_V4, 0, WORLD_ID,
DST_NODE_V4, ENCRYPT_KEY,
v4_pod_cidr_size);
#endif

#ifdef ENABLE_IPSEC
ipsec_set_encrypt_state(ENCRYPT_KEY);
node_v4_add_entry(DST_NODE_V4, DST_NODE_ID, ENCRYPT_KEY);
#endif

#ifdef TUNNEL_MODE
set_identity_mark(ctx, SRC_POD_SEC_IDENTITY, MARK_MAGIC_OVERLAY);
#else
set_identity_mark(ctx, SRC_POD_SEC_IDENTITY, MARK_MAGIC_IDENTITY);
#endif
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think what feels awkward is that we're overloading the test cases. In my mind what each test does is to take (1.) a certain controlplane-derived state (== BPF map entries) and (2.) a certain packet (headers, packet mark, tc_index, ...) - and evaluates how this is processed by the datapath, with a given Cilium config.

So what I would expect here is additional tests (that only get executed under TUNNEL_MODE), for how the datapath treats VXLAN packets with MARK_MAGIC_OVERLAY. I don't think we even need to handle the case where MARK_MAGIC_OVERLAY is not set for such a packet - unless we can explain a scenario where such a packet would occur. If we believe that fluctuation in controlplane-derived state matters for such packets, then let's add different tests for that.

What that also gives us is the opportunity to run the "standard" encryption tests, even when TUNNEL_MODE is set. And thus cover mixed-routing scenarios, where some endpoints are reachable without tunnel.

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. area/encryption Impacts encryption support such as IPSec, WireGuard, or kTLS. dont-merge/blocked Another PR must be merged before this one. feature/ipsec Relates to Cilium's IPsec feature feature/wireguard Relates to Cilium's Wireguard feature kind/enhancement This would improve or streamline existing functionality. release-note/ci This PR makes changes to the CI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants