Skip to content
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

tcp-proxy: support proxy-protocol tlvs #38131

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jronak
Copy link

@jronak jronak commented Jan 22, 2025

Additional Description: Adds support for passing Proxy Protocol TLVs in the Proxy Protocol header in tcp_proxy filter
Risk Level: low
Testing: unit test
Docs Changes: tcp-proxy proto config
Release Notes: none

@jronak jronak requested a review from alyssawilk as a code owner January 22, 2025 05:16
Copy link

Hi @jronak, welcome and thank you for your contribution.

We will try to review your Pull Request as quickly as possible.

In the meantime, please take a look at the contribution guidelines if you have not done so already.

🐱

Caused by: #38131 was opened by jronak.

see: more, trace.

Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @wbpcode
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #38131 was opened by jronak.

see: more, trace.

Copy link
Member

@phlax phlax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jronak could you fix DCO please

also there are quite a lot of other failures - some might be flakes but most look real

some of the format issues can be resolved by applying diffs from CI artefacts here https://github.com/envoyproxy/envoy/actions/runs/12901724937

api/envoy/config/core/v3/proxy_protocol.proto Outdated Show resolved Hide resolved
@jronak jronak force-pushed the ronakj/tcp-proxy-tlvs branch 2 times, most recently from 934a2cc to 44d5fa0 Compare January 23, 2025 04:54
@jronak
Copy link
Author

jronak commented Jan 24, 2025

@phlax fixed fmt and failed tests seems to be flaky. Could you trigger a re-run?

@phlax
Copy link
Member

phlax commented Jan 24, 2025

you can also ...

/retest

(please check that failures dont look real before retesting)

@jronak
Copy link
Author

jronak commented Jan 24, 2025

/retest

Copy link
Member

@wbpcode wbpcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. And the API is looks good to me.

/lgtm api

source/common/tcp_proxy/tcp_proxy.h Outdated Show resolved Hide resolved
@wbpcode wbpcode assigned alyssawilk and unassigned wbpcode Jan 26, 2025

if (!config.proxy_protocol_tlvs().empty()) {
proxy_protocol_tlvs_ =
Extensions::Common::ProxyProtocol::parseTLVs(config.proxy_protocol_tlvs());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally we try pretty hard to not add deps from core to extensions. Would it be possible to instead configure which TLVs we put into ProxyProtocolFilterState, and then simply copy all when we hit the tcp proxy session?
/wait-any

Copy link
Author

@jronak jronak Feb 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if I fully understand, but I believe this implementation achieves the same functionality:

  • Configuring TLVs to be populated in the proxy protocol filter state in the configuration.
  • Copying the parsed TLVs for each TCP proxy session.

I agree that we should avoid dependencies from core to extensions. To address this, we could:

  • Move the parseTLV method into core/tcp-proxy.
  • Create a new source/common/proxy_protocol module to host the parseTLV method, making it accessible without introducing unwanted dependencies. This might be better as this method will be needed for usage in HTTP connection manager.

Does this approach align with what you had in mind?

I have updated the PR to use approach 2 for easier iteration, open to your feedback

@jronak jronak force-pushed the ronakj/tcp-proxy-tlvs branch from aece64a to acbd222 Compare February 2, 2025 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants