bpf: nodeport: handle DSR at from-netdev / to-netdev#22978
Merged
YutaroHayakawa merged 7 commits intocilium:masterfrom Mar 7, 2023
Merged
bpf: nodeport: handle DSR at from-netdev / to-netdev#22978YutaroHayakawa merged 7 commits intocilium:masterfrom
YutaroHayakawa merged 7 commits intocilium:masterfrom
Conversation
Member
Author
|
/test |
b356961 to
c02dfcc
Compare
Member
Author
|
/test |
c02dfcc to
1e451ba
Compare
Member
Author
|
/test |
1e451ba to
2c357c2
Compare
Member
Author
|
/test |
2c357c2 to
33e3ee6
Compare
Member
Author
|
/test |
33e3ee6 to
fa8b7a3
Compare
Member
Author
|
/test |
fa8b7a3 to
c559ff5
Compare
Member
Author
|
/test |
3a3d73d to
e77c6f8
Compare
Member
Author
|
/test |
e77c6f8 to
eb355c3
Compare
Member
Author
|
/test |
eb355c3 to
d64bc25
Compare
Member
Author
|
/test |
Member
Author
|
Some ideas for reviewers to double-check:
|
6 tasks
julianwiedmann
added a commit
to julianwiedmann/cilium
that referenced
this pull request
Oct 30, 2023
DSR uses a OUT NAT entry for RevDNAT of backend replies. Prior to the changes in cilium#22978, this NAT entry was protected by the CT_INGRESS entry which bpf_lxc creates for the backend connection. Test that GC of the NAT entry works when the CT entry is removed. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
julianwiedmann
added a commit
to julianwiedmann/cilium
that referenced
this pull request
Oct 30, 2023
With cilium#22978 we changed how DSR NAT entries are managed. Instead of associating the NAT entry's lifetime with bpf_lxc's CT_INGRESS entry, the nodeport code on the backend now creates its own CT_EGRESS entry. When such a CT_EGRESS entry is GC'ed, we should therefore also purge the related DSR NAT entry. Also add a test for this case. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
julianwiedmann
added a commit
to julianwiedmann/cilium
that referenced
this pull request
Oct 30, 2023
With cilium#22978 we changed how DSR NAT entries are managed. Instead of associating the NAT entry's lifetime with bpf_lxc's CT_INGRESS entry, the nodeport code on the backend now creates its own CT_EGRESS entry. When such a CT_EGRESS entry is GC'ed, we should therefore also purge the related DSR NAT entry. Also add a test for this case. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
dylandreimerink
pushed a commit
that referenced
this pull request
Oct 30, 2023
DSR uses a OUT NAT entry for RevDNAT of backend replies. Prior to the changes in #22978, this NAT entry was protected by the CT_INGRESS entry which bpf_lxc creates for the backend connection. Test that GC of the NAT entry works when the CT entry is removed. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
dylandreimerink
pushed a commit
that referenced
this pull request
Oct 30, 2023
With #22978 we changed how DSR NAT entries are managed. Instead of associating the NAT entry's lifetime with bpf_lxc's CT_INGRESS entry, the nodeport code on the backend now creates its own CT_EGRESS entry. When such a CT_EGRESS entry is GC'ed, we should therefore also purge the related DSR NAT entry. Also add a test for this case. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
pippolo84
pushed a commit
to pippolo84/cilium
that referenced
this pull request
Oct 30, 2023
[ upstream commit 5b22423 ] DSR uses a OUT NAT entry for RevDNAT of backend replies. Prior to the changes in cilium#22978, this NAT entry was protected by the CT_INGRESS entry which bpf_lxc creates for the backend connection. Test that GC of the NAT entry works when the CT entry is removed. Signed-off-by: Julian Wiedmann <jwi@isovalent.com> Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
pippolo84
pushed a commit
to pippolo84/cilium
that referenced
this pull request
Oct 30, 2023
[ upstream commit 21072cd ] With cilium#22978 we changed how DSR NAT entries are managed. Instead of associating the NAT entry's lifetime with bpf_lxc's CT_INGRESS entry, the nodeport code on the backend now creates its own CT_EGRESS entry. When such a CT_EGRESS entry is GC'ed, we should therefore also purge the related DSR NAT entry. Also add a test for this case. Signed-off-by: Julian Wiedmann <jwi@isovalent.com> Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
pippolo84
pushed a commit
to pippolo84/cilium
that referenced
this pull request
Oct 30, 2023
[ upstream commit 5b22423 ] DSR uses a OUT NAT entry for RevDNAT of backend replies. Prior to the changes in cilium#22978, this NAT entry was protected by the CT_INGRESS entry which bpf_lxc creates for the backend connection. Test that GC of the NAT entry works when the CT entry is removed. Signed-off-by: Julian Wiedmann <jwi@isovalent.com> Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
pippolo84
pushed a commit
to pippolo84/cilium
that referenced
this pull request
Oct 30, 2023
[ upstream commit 21072cd ] With cilium#22978 we changed how DSR NAT entries are managed. Instead of associating the NAT entry's lifetime with bpf_lxc's CT_INGRESS entry, the nodeport code on the backend now creates its own CT_EGRESS entry. When such a CT_EGRESS entry is GC'ed, we should therefore also purge the related DSR NAT entry. Also add a test for this case. Signed-off-by: Julian Wiedmann <jwi@isovalent.com> Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
pippolo84
pushed a commit
to pippolo84/cilium
that referenced
this pull request
Oct 30, 2023
[ upstream commit 5b22423 ] DSR uses a OUT NAT entry for RevDNAT of backend replies. Prior to the changes in cilium#22978, this NAT entry was protected by the CT_INGRESS entry which bpf_lxc creates for the backend connection. Test that GC of the NAT entry works when the CT entry is removed. Signed-off-by: Julian Wiedmann <jwi@isovalent.com> Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
pippolo84
pushed a commit
to pippolo84/cilium
that referenced
this pull request
Oct 30, 2023
[ upstream commit 21072cd ] With cilium#22978 we changed how DSR NAT entries are managed. Instead of associating the NAT entry's lifetime with bpf_lxc's CT_INGRESS entry, the nodeport code on the backend now creates its own CT_EGRESS entry. When such a CT_EGRESS entry is GC'ed, we should therefore also purge the related DSR NAT entry. Also add a test for this case. Signed-off-by: Julian Wiedmann <jwi@isovalent.com> Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
pippolo84
pushed a commit
to pippolo84/cilium
that referenced
this pull request
Oct 30, 2023
[ upstream commit 5b22423 ] DSR uses a OUT NAT entry for RevDNAT of backend replies. Prior to the changes in cilium#22978, this NAT entry was protected by the CT_INGRESS entry which bpf_lxc creates for the backend connection. Test that GC of the NAT entry works when the CT entry is removed. Signed-off-by: Julian Wiedmann <jwi@isovalent.com> Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
pippolo84
pushed a commit
to pippolo84/cilium
that referenced
this pull request
Oct 30, 2023
[ upstream commit 21072cd ] With cilium#22978 we changed how DSR NAT entries are managed. Instead of associating the NAT entry's lifetime with bpf_lxc's CT_INGRESS entry, the nodeport code on the backend now creates its own CT_EGRESS entry. When such a CT_EGRESS entry is GC'ed, we should therefore also purge the related DSR NAT entry. Also add a test for this case. Signed-off-by: Julian Wiedmann <jwi@isovalent.com> Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
pippolo84
pushed a commit
to pippolo84/cilium
that referenced
this pull request
Oct 31, 2023
[ upstream commit 5b22423 ] DSR uses a OUT NAT entry for RevDNAT of backend replies. Prior to the changes in cilium#22978, this NAT entry was protected by the CT_INGRESS entry which bpf_lxc creates for the backend connection. Test that GC of the NAT entry works when the CT entry is removed. Signed-off-by: Julian Wiedmann <jwi@isovalent.com> Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
pippolo84
pushed a commit
to pippolo84/cilium
that referenced
this pull request
Oct 31, 2023
[ upstream commit 21072cd ] With cilium#22978 we changed how DSR NAT entries are managed. Instead of associating the NAT entry's lifetime with bpf_lxc's CT_INGRESS entry, the nodeport code on the backend now creates its own CT_EGRESS entry. When such a CT_EGRESS entry is GC'ed, we should therefore also purge the related DSR NAT entry. Also add a test for this case. Signed-off-by: Julian Wiedmann <jwi@isovalent.com> Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
pippolo84
pushed a commit
to pippolo84/cilium
that referenced
this pull request
Oct 31, 2023
[ upstream commit 5b22423 ] DSR uses a OUT NAT entry for RevDNAT of backend replies. Prior to the changes in cilium#22978, this NAT entry was protected by the CT_INGRESS entry which bpf_lxc creates for the backend connection. Test that GC of the NAT entry works when the CT entry is removed. Signed-off-by: Julian Wiedmann <jwi@isovalent.com> Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
pippolo84
pushed a commit
to pippolo84/cilium
that referenced
this pull request
Oct 31, 2023
[ upstream commit 21072cd ] With cilium#22978 we changed how DSR NAT entries are managed. Instead of associating the NAT entry's lifetime with bpf_lxc's CT_INGRESS entry, the nodeport code on the backend now creates its own CT_EGRESS entry. When such a CT_EGRESS entry is GC'ed, we should therefore also purge the related DSR NAT entry. Also add a test for this case. Signed-off-by: Julian Wiedmann <jwi@isovalent.com> Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
aditighag
pushed a commit
that referenced
this pull request
Nov 2, 2023
[ upstream commit 5b22423 ] DSR uses a OUT NAT entry for RevDNAT of backend replies. Prior to the changes in #22978, this NAT entry was protected by the CT_INGRESS entry which bpf_lxc creates for the backend connection. Test that GC of the NAT entry works when the CT entry is removed. Signed-off-by: Julian Wiedmann <jwi@isovalent.com> Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
aditighag
pushed a commit
that referenced
this pull request
Nov 2, 2023
[ upstream commit 21072cd ] With #22978 we changed how DSR NAT entries are managed. Instead of associating the NAT entry's lifetime with bpf_lxc's CT_INGRESS entry, the nodeport code on the backend now creates its own CT_EGRESS entry. When such a CT_EGRESS entry is GC'ed, we should therefore also purge the related DSR NAT entry. Also add a test for this case. Signed-off-by: Julian Wiedmann <jwi@isovalent.com> Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
pippolo84
pushed a commit
to pippolo84/cilium
that referenced
this pull request
Nov 3, 2023
[ upstream commit 5b22423 ] DSR uses a OUT NAT entry for RevDNAT of backend replies. Prior to the changes in cilium#22978, this NAT entry was protected by the CT_INGRESS entry which bpf_lxc creates for the backend connection. Test that GC of the NAT entry works when the CT entry is removed. Signed-off-by: Julian Wiedmann <jwi@isovalent.com> Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
pippolo84
pushed a commit
to pippolo84/cilium
that referenced
this pull request
Nov 3, 2023
[ upstream commit 21072cd ] With cilium#22978 we changed how DSR NAT entries are managed. Instead of associating the NAT entry's lifetime with bpf_lxc's CT_INGRESS entry, the nodeport code on the backend now creates its own CT_EGRESS entry. When such a CT_EGRESS entry is GC'ed, we should therefore also purge the related DSR NAT entry. Also add a test for this case. Signed-off-by: Julian Wiedmann <jwi@isovalent.com> Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
(see partner PR #22756)
Replies by DSR service backends currently get their revDNAT processing in
from-container. There's two problems with that:
from-container program (ie. redirect to host proxy), and
This PR tackles the problem as follows:
to-netdevpath.local-backendcase). Use the DSR info to build a SNAT entry for RevDNAT of the backend replies.to-netdevas well, but let's try that in a follow-on PR.Updated nodeport ingress diagram:
flowchart TD A[from-netdev] -->|CILIUM_CALL_IPV4_FROM_NETDEV| B{"bpf_skip_nodeport()?"} B --> |No| C["nodeport_lb4()"] B --> |Yes| B1["// further packet process"] C --> D["lb4_lookup_service()"] D --> E{"dst is svc ?"} E --> |No| F{"has DSR info / CT entry with .dsr set?"} E --> |Yes| F1["lb4_local()"] F --> |Yes| F2[" "] F2 --> |CILIUM_CALL_IPV4_NODEPORT_DSR_INGRESS| X["tail_nodeport_dsr_ingress_ipv4()"] X --> X1["create / update CT entry and SNAT entry"] X1 --> X2["bpf_skip_nodeport_set()"] X2 --> |CILIUM_CALL_IPV4_FROM_NETDEV| B F1 --> G1{"backend local?"} G1 --> |Yes| H1["CTX_ACT_OK"] G1 --> |No| H2[" "] H2 --> |CILIUM_CALL_IPV4_NODEPORT_NAT_EGRESS| G2["tail_nodeport_nat_egress_ipv4()"] G2 --> J2["snat_v4_nat()"] J2 --> K2{"found new SNAT mapping?"} K2 --> |No| L2["CTX_ACT_DROP"] K2 --> |Yes| M2["// Do SNAT"] M2 --> N2["ctx_redirect()"] F --> |No| F3[" "] F3 --> |CILIUM_CALL_IPV4_NODEPORT_NAT_INGRESS| G["tail_nodeport_nat_ingress_ipv4()"] G --> H["snat_v4_rev_nat()"] H --> J{"Reverse mapping exist?"} J --> |No| K["bpf_skip_nodeport_set()"] K --> |CILIUM_CALL_IPV4_FROM_NETDEV| B J --> |"Yes\n(This can be rev-SNAT for outside2pod)"| L["tail_rev_nodeport_lb4()"] L --> M["rev_nodeport_lb4()"] M --> N["ct_lb_lookup4()"] N --> O{"NodePort CT reply?"} O --> |Yes| P["// do rev-DNAT"] P --> R["ctx_redirect()"] O --> |No| Q["bpf_skip_nodeport_set()"] Q --> |CILIUM_CALL_IPV4_FROM_NETDEV| B