Skip to content

bpf_metadata: select ingress source IP by destination family#1944

Open
elohmeier wants to merge 1 commit into
cilium:mainfrom
elohmeier:fix/bpf-metadata-proxy-protocol-family
Open

bpf_metadata: select ingress source IP by destination family#1944
elohmeier wants to merge 1 commit into
cilium:mainfrom
elohmeier:fix/bpf-metadata-proxy-protocol-family

Conversation

@elohmeier

Copy link
Copy Markdown

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.cc
  • git diff --check
  • bazel test --copt=-Wno-nullability-completeness //tests:bpf_metadata_config_test could not complete in my local ostree environment after rebasing because the repo toolchain expects /usr/bin/clang, which is not present and /usr is 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 expected x-forwarded-for / x-envoy-external-address client IPs.

Signed-off-by: Enno Richter <2536303+elohmeier@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant