-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Closed
Copy link
Labels
area/datapathImpacts bpf/ or low-level forwarding details, including map management and monitor messages.Impacts bpf/ or low-level forwarding details, including map management and monitor messages.kind/cleanupThis includes no functional changes.This includes no functional changes.
Description
Split the snat_v{4,6}_process()
functions into nat_snat_v{4,6}()
and nat_rev_snat_v{4,6}()
.
The proposed change would not only improve the readability of the datapath code, but also should reduce the verifier complexity of the code path which is responsible for doing the rev-SNAT translations, as no new SNAT mapping needs to be find for this code path (only the lookup in the BPF SNAT map).
After inspecting the bpf/lib/nodeport.h
, we have the following code paths which involve the SNAT:
to-netdev@bpf_host
: thesnat_v*_process()
is called withNAT_DIR_EGRESS
. It is used to SNAT outgoing packets.from-netdev@bpf_host
(vianodeport_lb{4,6}()
):- When a service is not found, the function is called with
NAT_DIR_INGRESS
. It is used to rev-SNAT incoming packets (e.g., outside => pod, replies from remote service backends). - When a service is found, with
NAT_DIR_EGRESS
. It is used to SNAT a service request to a remote node.
- When a service is not found, the function is called with
From the above, nat_snat_v*()
would be called for NAT_DIR_EGRESS
, while nat_rev_snat_v*()
for NAT_DIR_INGRESS
.
Metadata
Metadata
Assignees
Labels
area/datapathImpacts bpf/ or low-level forwarding details, including map management and monitor messages.Impacts bpf/ or low-level forwarding details, including map management and monitor messages.kind/cleanupThis includes no functional changes.This includes no functional changes.