bpf_metadata: select ingress source IP by destination family#1944
Open
elohmeier wants to merge 1 commit into
Open
bpf_metadata: select ingress source IP by destination family#1944elohmeier wants to merge 1 commit into
elohmeier wants to merge 1 commit into
Conversation
Signed-off-by: Enno Richter <2536303+elohmeier@users.noreply.github.com>
Open
3 tasks
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.
North/south L7 LB metadata currently selects the configured local ingress source address using the incoming source address family. When a load balancer forwards an IPv6 client address via PROXY protocol to an IPv4-only node/backend path, the source address is IPv6 but the destination connection is IPv4. In that case the metadata filter looks for an IPv6 ingress source address even though the outbound connection needs the configured IPv4 source address, and metadata extraction fails.
This changes the source-address selection to use the destination address family instead. That matches the address family used by the outbound connection while still preserving the remote source address from PROXY protocol for downstream metadata.
A regression test covers an IPv6 remote source with only an IPv4 local ingress source address configured.
Validation:
/home/linuxbrew/.linuxbrew/opt/llvm/bin/clang-format --dry-run -Werror cilium/bpf_metadata.cc tests/bpf_metadata_config_test.ccgit diff --checkbazel test --copt=-Wno-nullability-completeness //tests:bpf_metadata_config_testcould not complete in my local ostree environment after rebasing because the repo toolchain expects/usr/bin/clang, which is not present and/usris read-only. The change was also built into a Cilium Envoy image and smoke-tested behind a Cilium Gateway with PROXY protocol: IPv4 and IPv6 requests both succeeded, and the backend received the expectedx-forwarded-for/x-envoy-external-addressclient IPs.