Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpf: nodeport: SNAT before adding tunnel info in NAT egress path #25305

Merged

Conversation

julianwiedmann
Copy link
Member

When forwarding to a remote backend via tunnel, we currently first add the encap info and only then apply SNAT to the packet. Meaning that the TRACE_TO_OVERLAY in __encap_with_nodeid() doesn't report the final header content.

This is in contrast to the non-tunnel path (where the TRACE_TO_NETWORK in to-netdev will report the post-SNAT header content), and the reply path (where from-overlay raises the TRACE_FROM_OVERLAY long before checking for revSNAT).

So re-order the NAT egress path to first apply SNAT, and then add the encap info afterwards.

For now this just helps to make the TRACE_TO_OVERLAY entry consistent. In the future it's also needed to enable in-XDP encap (as we want to SNAT the inner packet, before adding the encap headers).

@julianwiedmann julianwiedmann added sig/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages. release-note/misc This PR makes changes that have no direct user impact. labels May 8, 2023
@julianwiedmann julianwiedmann requested a review from a team as a code owner May 8, 2023 06:16
@julianwiedmann
Copy link
Member Author

/test

When forwarding to a remote backend via tunnel, we currently first add
the encap info and only then apply SNAT to the packet. Meaning that
the TRACE_TO_OVERLAY in __encap_with_nodeid() doesn't report the final
header content.

This is in contrast to the non-tunnel path (where the TRACE_TO_NETWORK
in to-netdev will report the post-SNAT header content), and the reply
path (where from-overlay raises the TRACE_FROM_OVERLAY long before checking
for revSNAT).

So re-order the NAT egress path to first apply SNAT, and then add the
encap info afterwards.

For now this just helps to make the TRACE_TO_OVERLAY entry consistent. In
the future it's also needed to enable in-XDP encap (as we want to SNAT the
inner packet, before adding the encap headers).

Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
@julianwiedmann
Copy link
Member Author

/ci-e2e

@julianwiedmann
Copy link
Member Author

/test

@julianwiedmann
Copy link
Member Author

net-next: Timed out while waiting for the machine to boot

@julianwiedmann
Copy link
Member Author

/test-1.26-net-next

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label May 8, 2023
@julianwiedmann julianwiedmann merged commit 64dbfd2 into cilium:main May 8, 2023
57 checks passed
@julianwiedmann julianwiedmann deleted the 1.14-nodeport-tunnel-snat branch May 8, 2023 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact. sig/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants