-
Notifications
You must be signed in to change notification settings - Fork 3.4k
bpf: convert IPV4_LOOPBACK to runtime variable, pass IPv4 addresses using union v4addr #38818
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
Conversation
24cbc83
to
7623d30
Compare
cc @ti-mo |
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.
LGTM for agent changes
/test |
1 similar comment
/test |
/ci-eks |
/ci-e2e-upgrade |
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.
Thanks for pushing this forward! Left a few comments. This is great to get our feet wet so we can figure out some conventions.
7623d30
to
b2b54ed
Compare
@ti-mo I gave this another pass. I had to introduce the ugly |
b2b54ed
to
2a89191
Compare
2a89191
to
8dc77a9
Compare
/test |
That's totally fine! Most kernel headers I've seen encode ipv4 addrs as be32 types, so we'll always need a union to bridge them. From the user space perspective, we def want to provide bytes, not u32. I've added some extra commits to make v4 config plumbing consistent across the datapath, as well as changed the name of the config. I've always found IPV4_LOOPBACK really confusing as it isn't a loopback address in the traditional sense. It's an internal address used for SNAT for hairpin traffic through a Service. |
/test |
5f2d945
to
d9d5033
Compare
/test |
The CI failures are real; Pods don't manage to talk to themselves over Services. I either made a silly mistake somewhere, or LocalNodeConfig.ServiceLoopbackIPv4 is always nil nodeConfig(). We always get |
Naming things is hard. LoopbackIPv4 is one of those variables I've always been confused by. Its use and meaning was documented in some places, but the name was always somewhat of a misnomer. It's not an address bound to a loopback interface. It's not a valid destination address for a packet. It's an internal implementation detail that sometimes needs to be overridden when it overlaps with an in-use address range. This commit replaces all occurrences of LoopbackIPv4 with ServiceLoopbackIPv4 and extends docstrings wherever the existing doc was too terse. Signed-off-by: Timo Beckers <timo@isovalent.com>
Revive my older PR, cilium#38022, since support for NODE_CONFIG was merged and move IPV4_LOOPBACK out of node_config.h. Signed-off-by: Jordan Rife <jrife@google.com> Signed-off-by: Timo Beckers <timo@isovalent.com>
From the agent's side, we want to avoid endianness conversions since they make the end result hard to reason about. Convert endpoint_ipv4 to union v4addr to allow the agent to provide netip.Addr bytes. Substitute the LXC_IPV4 macro with CONFIG(endpoint_ipv4). Signed-off-by: Timo Beckers <timo@isovalent.com>
Like the previous commit, this converts nat_ipv4_masquerade to union v4addr and removes the backwards-compat macro. Signed-off-by: Timo Beckers <timo@isovalent.com>
d9d5033
to
909e344
Compare
/test |
lgtm, thanks! I downgraded to |
Since support for
NODE_CONFIG
was merged, revive the part of my older PR, #38022, that movedIPV4_LOOPBACK
out of node_config.h. I wanted to start small for now to make sure I'm on the right track before migrating more config. This is part of #38370.