-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
egressgw: Redirect from bpf_overlay to egress gw SNAT netdev #29379
Merged
julianwiedmann
merged 3 commits into
cilium:main
from
ysksuzuki:egress-gw-redirect-from-overlay
Nov 27, 2023
Merged
egressgw: Redirect from bpf_overlay to egress gw SNAT netdev #29379
julianwiedmann
merged 3 commits into
cilium:main
from
ysksuzuki:egress-gw-redirect-from-overlay
Nov 27, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit fixes the problem that an iptables SNAT rule in the host netns interferes with packets to egress gw by redirecting from bpf_overlay. Fixes: cilium#17848 Signed-off-by: Yusuke Suzuki <yusuke.suzuki@isovalent.com>
…hook So that we can remove the duplicate check in nat.h and bpf_overlay.h Signed-off-by: Yusuke Suzuki <yusuke.suzuki@isovalent.com>
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
Nov 27, 2023
Signed-off-by: Yusuke Suzuki <yusuke.suzuki@isovalent.com>
ysksuzuki
force-pushed
the
egress-gw-redirect-from-overlay
branch
from
November 27, 2023 08:20
87d0bcd
to
15a3b6c
Compare
/test |
julianwiedmann
added
kind/bug
This is a bug in the Cilium logic.
sig/datapath
Impacts bpf/ or low-level forwarding details, including map management and monitor messages.
feature/egress-gateway
Impacts the egress IP gateway feature.
release-note/bug
This PR fixes an issue in a previous release of Cilium.
labels
Nov 27, 2023
maintainer-s-little-helper
bot
removed
the
dont-merge/needs-release-note-label
The author needs to describe the release impact of these changes.
label
Nov 27, 2023
julianwiedmann
approved these changes
Nov 27, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, looks good!
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
Nov 27, 2023
julianwiedmann
added a commit
to julianwiedmann/cilium
that referenced
this pull request
May 8, 2024
To let EGW traffic exit the gateway through the correct interface, we've introduced FIB lookup-driven redirects in the to-netdev path (cilium#26215). This is needed for cases where the traffic first hits one interface via the default route, but then needs to bounce to some other interface that matches the actual egressIP. In this approach we masquerade the packet on its first pass through to-netdev, set the SNAT_DONE mark, and then redirect to the actual egress interface. Due to the SNAT_DONE mark we then skip the SNAT logic in the second pass through to-netdev. cilium#29379 then improved the situation for any EGW traffic that enters the gateway from the overlay network (== anything that's not by a pod on the gateway). We now redirect in from-overlay, straight to the actual egress interface and masquerade the packet there. Now also harmonize the approach for local pods, and defer the masquerade until the packet hits the actual egress interface. This simplifies the overall picture, and also allows us to raise TO_NETWORK datapath trace events that are enriched with the packet's original source IP. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
julianwiedmann
added a commit
to julianwiedmann/cilium
that referenced
this pull request
May 8, 2024
To let EGW traffic exit the gateway through the correct interface, we've introduced FIB lookup-driven redirects in the to-netdev path (cilium#26215). This is needed for cases where the traffic first hits one interface via the default route, but then needs to bounce to some other interface that matches the actual egressIP. In this approach we masquerade the packet on its first pass through to-netdev, set the SNAT_DONE mark, and then redirect to the actual egress interface. Due to the SNAT_DONE mark we then skip the SNAT logic in the second pass through to-netdev. cilium#29379 then improved the situation for any EGW traffic that enters the gateway from the overlay network (== anything that's not by a pod on the gateway). We now redirect in from-overlay, straight to the actual egress interface and masquerade the packet there. Now also harmonize the approach for local pods, and defer the masquerade until the packet hits the actual egress interface. This simplifies the overall picture, and also allows us to raise TO_NETWORK datapath trace events that are enriched with the packet's original source IP. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
julianwiedmann
added a commit
to julianwiedmann/cilium
that referenced
this pull request
May 14, 2024
To let EGW traffic exit the gateway through the correct interface, we've introduced FIB lookup-driven redirects in the to-netdev path (cilium#26215). This is needed for cases where the traffic first hits one interface via the default route, but then needs to bounce to some other interface that matches the actual egressIP. In this approach we masquerade the packet on its first pass through to-netdev, set the SNAT_DONE mark, and then redirect to the actual egress interface. Due to the SNAT_DONE mark we then skip the SNAT logic in the second pass through to-netdev. cilium#29379 then improved the situation for any EGW traffic that enters the gateway from the overlay network (== anything that's not by a pod on the gateway). We now redirect in from-overlay, straight to the actual egress interface and masquerade the packet there. Now also harmonize the approach for local pods, and defer the masquerade until the packet hits the actual egress interface. This simplifies the overall picture. But it also allows us to raise TO_NETWORK datapath trace events that are enriched with the packet's original source IP - this event is raised on the *second* pass through to-netdev, so we need the SNAT to happen at the same time. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
julianwiedmann
added a commit
to julianwiedmann/cilium
that referenced
this pull request
May 14, 2024
To let EGW traffic exit the gateway through the correct interface, we've introduced FIB lookup-driven redirects in the to-netdev path (cilium#26215). This is needed for cases where the traffic first hits one interface via the default route, but then needs to bounce to some other interface that matches the actual egressIP. In this approach we masquerade the packet on its first pass through to-netdev, set the SNAT_DONE mark, and then redirect to the actual egress interface. Due to the SNAT_DONE mark we then skip the SNAT logic in the second pass through to-netdev. cilium#29379 then improved the situation for any EGW traffic that enters the gateway from the overlay network (== anything that's not by a pod on the gateway). We now redirect in from-overlay, straight to the actual egress interface and masquerade the packet there. Now also harmonize the approach for local pods, and defer the masquerade until the packet hits the actual egress interface. This simplifies the overall picture. But it also allows us to raise TO_NETWORK datapath trace events that are enriched with the packet's original source IP - this event is raised on the *second* pass through to-netdev, so we need the SNAT to happen at the same time. Also add a comment to clarify the check to skip HostFW for SNATed traffic. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
julianwiedmann
added a commit
to julianwiedmann/cilium
that referenced
this pull request
May 14, 2024
To let EGW traffic exit the gateway through the correct interface, we've introduced FIB lookup-driven redirects in the to-netdev path (cilium#26215). This is needed for cases where the traffic first hits one interface via the default route, but then needs to bounce to some other interface that matches the actual egressIP. In this approach we masquerade the packet on its first pass through to-netdev, set the SNAT_DONE mark, and then redirect to the actual egress interface. Due to the SNAT_DONE mark we then skip the SNAT logic in the second pass through to-netdev. cilium#29379 then improved the situation for any EGW traffic that enters the gateway from the overlay network (== anything that's not by a pod on the gateway). We now redirect in from-overlay, straight to the actual egress interface and masquerade the packet there. Now also harmonize the approach for local pods, and defer the masquerade until the packet hits the actual egress interface. This simplifies the overall picture. But it also allows us to raise TO_NETWORK datapath trace events that are enriched with the packet's original source IP - this event is raised on the *second* pass through to-netdev, so we need the SNAT to happen at the same time. Also add a comment to clarify the check to skip HostFW for SNATed traffic. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
julianwiedmann
added a commit
to julianwiedmann/cilium
that referenced
this pull request
May 14, 2024
To let EGW traffic exit the gateway through the correct interface, we've introduced FIB lookup-driven redirects in the to-netdev path (cilium#26215). This is needed for cases where the traffic first hits one interface via the default route, but then needs to bounce to some other interface that matches the actual egressIP. In this approach we masquerade the packet on its first pass through to-netdev, set the SNAT_DONE mark, and then redirect to the actual egress interface. Due to the SNAT_DONE mark we then skip the SNAT logic in the second pass through to-netdev. cilium#29379 then improved the situation for any EGW traffic that enters the gateway from the overlay network (== anything that's not by a pod on the gateway). We now redirect in from-overlay, straight to the actual egress interface and masquerade the packet there. Now also harmonize the approach for local pods, and defer the masquerade until the packet hits the actual egress interface. This simplifies the overall picture. But it also allows us to raise TO_NETWORK datapath trace events that are enriched with the packet's original source IP - this event is raised on the *second* pass through to-netdev, so we need the SNAT to happen at the same time. Also add a comment to clarify the check to skip HostFW for SNATed traffic. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
julianwiedmann
added a commit
to julianwiedmann/cilium
that referenced
this pull request
May 14, 2024
To let EGW traffic exit the gateway through the correct interface, we've introduced FIB lookup-driven redirects in the to-netdev path (cilium#26215). This is needed for cases where the traffic first hits one interface via the default route, but then needs to bounce to some other interface that matches the actual egressIP. In this approach we masquerade the packet on its first pass through to-netdev, set the SNAT_DONE mark, and then redirect to the actual egress interface. Due to the SNAT_DONE mark we then skip the SNAT logic in the second pass through to-netdev. cilium#29379 then improved the situation for any EGW traffic that enters the gateway from the overlay network (== anything that's not by a pod on the gateway). We now redirect in from-overlay, straight to the actual egress interface and masquerade the packet there. Now also harmonize the approach for local pods, and defer the masquerade until the packet hits the actual egress interface. This simplifies the overall picture. But it also allows us to raise TO_NETWORK datapath trace events that are enriched with the packet's original source IP - this event is raised on the *second* pass through to-netdev, so we need the SNAT to happen at the same time. Also add a comment to clarify the check to skip HostFW for SNATed traffic. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
julianwiedmann
added a commit
to julianwiedmann/cilium
that referenced
this pull request
May 14, 2024
To let EGW traffic exit the gateway through the correct interface, we've introduced FIB lookup-driven redirects in the to-netdev path (cilium#26215). This is needed for cases where the traffic first hits one interface via the default route, but then needs to bounce to some other interface that matches the actual egressIP. In this approach we masquerade the packet on its first pass through to-netdev, set the SNAT_DONE mark, and then redirect to the actual egress interface. Due to the SNAT_DONE mark we then skip the SNAT logic in the second pass through to-netdev. cilium#29379 then improved the situation for any EGW traffic that enters the gateway from the overlay network (== anything that's not by a pod on the gateway). We now redirect in from-overlay, straight to the actual egress interface and masquerade the packet there. Now also harmonize the approach for local pods, and defer the masquerade until the packet hits the actual egress interface. This simplifies the overall picture. But it also allows us to raise TO_NETWORK datapath trace events that are enriched with the packet's original source IP - this event is raised on the *second* pass through to-netdev, so we need the SNAT to happen at the same time. Also add a comment to clarify the check to skip HostFW for SNATed traffic. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
julianwiedmann
added a commit
to julianwiedmann/cilium
that referenced
this pull request
May 14, 2024
To let EGW traffic exit the gateway through the correct interface, we've introduced FIB lookup-driven redirects in the to-netdev path (cilium#26215). This is needed for cases where the traffic first hits one interface via the default route, but then needs to bounce to some other interface that matches the actual egressIP. In this approach we masquerade the packet on its first pass through to-netdev, set the SNAT_DONE mark, and then redirect to the actual egress interface. Due to the SNAT_DONE mark we then skip the SNAT logic in the second pass through to-netdev. cilium#29379 then improved the situation for any EGW traffic that enters the gateway from the overlay network (== anything that's not by a pod on the gateway). We now redirect in from-overlay, straight to the actual egress interface and masquerade the packet there. Now also harmonize the approach for local pods, and defer the masquerade until the packet hits the actual egress interface. This simplifies the overall picture. But it also allows us to raise TO_NETWORK datapath trace events that are enriched with the packet's original source IP - this event is raised on the *second* pass through to-netdev, so we need the SNAT to happen at the same time. Also add a comment to clarify the check to skip HostFW for SNATed traffic. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
julianwiedmann
added a commit
to julianwiedmann/cilium
that referenced
this pull request
May 14, 2024
To let EGW traffic exit the gateway through the correct interface, we've introduced FIB lookup-driven redirects in the to-netdev path (cilium#26215). This is needed for cases where the traffic first hits one interface via the default route, but then needs to bounce to some other interface that matches the actual egressIP. In this approach we masquerade the packet on its first pass through to-netdev, set the SNAT_DONE mark, and then redirect to the actual egress interface. Due to the SNAT_DONE mark we then skip the SNAT logic in the second pass through to-netdev. cilium#29379 then improved the situation for any EGW traffic that enters the gateway from the overlay network (== anything that's not by a pod on the gateway). We now redirect in from-overlay, straight to the actual egress interface and masquerade the packet there. Now also harmonize the approach for local pods, and defer the masquerade until the packet hits the actual egress interface. This simplifies the overall picture. But it also allows us to raise TO_NETWORK datapath trace events that are enriched with the packet's original source IP - this event is raised on the *second* pass through to-netdev, so we need the SNAT to happen at the same time. Also add a comment to clarify the check to skip HostFW for SNATed traffic. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
julianwiedmann
added a commit
to julianwiedmann/cilium
that referenced
this pull request
May 14, 2024
To let EGW traffic exit the gateway through the correct interface, we've introduced FIB lookup-driven redirects in the to-netdev path (cilium#26215). This is needed for cases where the traffic first hits one interface via the default route, but then needs to bounce to some other interface that matches the actual egressIP. In this approach we masquerade the packet on its first pass through to-netdev, set the SNAT_DONE mark, and then redirect to the actual egress interface. Due to the SNAT_DONE mark we then skip the SNAT logic in the second pass through to-netdev. cilium#29379 then improved the situation for any EGW traffic that enters the gateway from the overlay network (== anything that's not by a pod on the gateway). We now redirect in from-overlay, straight to the actual egress interface and masquerade the packet there. Now also harmonize the approach for local pods, and defer the masquerade until the packet hits the actual egress interface. This simplifies the overall picture. But it also allows us to raise TO_NETWORK datapath trace events that are enriched with the packet's original source IP - this event is raised on the *second* pass through to-netdev, so we need the SNAT to happen at the same time. Also add a comment to clarify the check to skip HostFW for SNATed traffic. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
github-merge-queue bot
pushed a commit
that referenced
this pull request
May 23, 2024
To let EGW traffic exit the gateway through the correct interface, we've introduced FIB lookup-driven redirects in the to-netdev path (#26215). This is needed for cases where the traffic first hits one interface via the default route, but then needs to bounce to some other interface that matches the actual egressIP. In this approach we masquerade the packet on its first pass through to-netdev, set the SNAT_DONE mark, and then redirect to the actual egress interface. Due to the SNAT_DONE mark we then skip the SNAT logic in the second pass through to-netdev. #29379 then improved the situation for any EGW traffic that enters the gateway from the overlay network (== anything that's not by a pod on the gateway). We now redirect in from-overlay, straight to the actual egress interface and masquerade the packet there. Now also harmonize the approach for local pods, and defer the masquerade until the packet hits the actual egress interface. This simplifies the overall picture. But it also allows us to raise TO_NETWORK datapath trace events that are enriched with the packet's original source IP - this event is raised on the *second* pass through to-netdev, so we need the SNAT to happen at the same time. Also add a comment to clarify the check to skip HostFW for SNATed traffic. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
joamaki
pushed a commit
that referenced
this pull request
May 30, 2024
[ upstream commit cf6b203 ] To let EGW traffic exit the gateway through the correct interface, we've introduced FIB lookup-driven redirects in the to-netdev path (#26215). This is needed for cases where the traffic first hits one interface via the default route, but then needs to bounce to some other interface that matches the actual egressIP. In this approach we masquerade the packet on its first pass through to-netdev, set the SNAT_DONE mark, and then redirect to the actual egress interface. Due to the SNAT_DONE mark we then skip the SNAT logic in the second pass through to-netdev. #29379 then improved the situation for any EGW traffic that enters the gateway from the overlay network (== anything that's not by a pod on the gateway). We now redirect in from-overlay, straight to the actual egress interface and masquerade the packet there. Now also harmonize the approach for local pods, and defer the masquerade until the packet hits the actual egress interface. This simplifies the overall picture. But it also allows us to raise TO_NETWORK datapath trace events that are enriched with the packet's original source IP - this event is raised on the *second* pass through to-netdev, so we need the SNAT to happen at the same time. Also add a comment to clarify the check to skip HostFW for SNATed traffic. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
joamaki
pushed a commit
that referenced
this pull request
May 30, 2024
[ upstream commit cf6b203 ] To let EGW traffic exit the gateway through the correct interface, we've introduced FIB lookup-driven redirects in the to-netdev path (#26215). This is needed for cases where the traffic first hits one interface via the default route, but then needs to bounce to some other interface that matches the actual egressIP. In this approach we masquerade the packet on its first pass through to-netdev, set the SNAT_DONE mark, and then redirect to the actual egress interface. Due to the SNAT_DONE mark we then skip the SNAT logic in the second pass through to-netdev. #29379 then improved the situation for any EGW traffic that enters the gateway from the overlay network (== anything that's not by a pod on the gateway). We now redirect in from-overlay, straight to the actual egress interface and masquerade the packet there. Now also harmonize the approach for local pods, and defer the masquerade until the packet hits the actual egress interface. This simplifies the overall picture. But it also allows us to raise TO_NETWORK datapath trace events that are enriched with the packet's original source IP - this event is raised on the *second* pass through to-netdev, so we need the SNAT to happen at the same time. Also add a comment to clarify the check to skip HostFW for SNATed traffic. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
joamaki
pushed a commit
that referenced
this pull request
May 30, 2024
[ upstream commit cf6b203 ] To let EGW traffic exit the gateway through the correct interface, we've introduced FIB lookup-driven redirects in the to-netdev path (#26215). This is needed for cases where the traffic first hits one interface via the default route, but then needs to bounce to some other interface that matches the actual egressIP. In this approach we masquerade the packet on its first pass through to-netdev, set the SNAT_DONE mark, and then redirect to the actual egress interface. Due to the SNAT_DONE mark we then skip the SNAT logic in the second pass through to-netdev. #29379 then improved the situation for any EGW traffic that enters the gateway from the overlay network (== anything that's not by a pod on the gateway). We now redirect in from-overlay, straight to the actual egress interface and masquerade the packet there. Now also harmonize the approach for local pods, and defer the masquerade until the packet hits the actual egress interface. This simplifies the overall picture. But it also allows us to raise TO_NETWORK datapath trace events that are enriched with the packet's original source IP - this event is raised on the *second* pass through to-netdev, so we need the SNAT to happen at the same time. Also add a comment to clarify the check to skip HostFW for SNATed traffic. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
joamaki
pushed a commit
that referenced
this pull request
May 31, 2024
[ upstream commit cf6b203 ] To let EGW traffic exit the gateway through the correct interface, we've introduced FIB lookup-driven redirects in the to-netdev path (#26215). This is needed for cases where the traffic first hits one interface via the default route, but then needs to bounce to some other interface that matches the actual egressIP. In this approach we masquerade the packet on its first pass through to-netdev, set the SNAT_DONE mark, and then redirect to the actual egress interface. Due to the SNAT_DONE mark we then skip the SNAT logic in the second pass through to-netdev. #29379 then improved the situation for any EGW traffic that enters the gateway from the overlay network (== anything that's not by a pod on the gateway). We now redirect in from-overlay, straight to the actual egress interface and masquerade the packet there. Now also harmonize the approach for local pods, and defer the masquerade until the packet hits the actual egress interface. This simplifies the overall picture. But it also allows us to raise TO_NETWORK datapath trace events that are enriched with the packet's original source IP - this event is raised on the *second* pass through to-netdev, so we need the SNAT to happen at the same time. Also add a comment to clarify the check to skip HostFW for SNATed traffic. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
feature/egress-gateway
Impacts the egress IP gateway feature.
kind/bug
This is a bug in the Cilium logic.
ready-to-merge
This PR has passed all tests and received consensus from code owners to merge.
release-note/bug
This PR fixes an issue in a previous release of Cilium.
sig/datapath
Impacts bpf/ or low-level forwarding details, including map management and monitor messages.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes the problem that an iptables SNAT rule in the host netns interferes with packets to egress gw by redirecting from bpf_overlay.
Fixes: #17848