Skip to content

http: fix issues in CONNECT-UDP forwarding mode. - #36174

Merged
RyanTheOptimist merged 10 commits into
envoyproxy:mainfrom
jeongseokson:connect_udp_forwarding_proxy_fix
Sep 23, 2024
Merged

RyanTheOptimist merged 10 commits into
envoyproxy:mainfrom
jeongseokson:connect_udp_forwarding_proxy_fix

Conversation

@jeongseokson

@jeongseokson jeongseokson commented Sep 17, 2024 •

Copy link
Copy Markdown
Contributor

Commit Message:
When Envoy operates as a CONNECT-UDP forwarding proxy, it was resetting the upstream stream because it received HTTP Datagrams before receiving the SETTINGS frame. A new enum has been added in QUICHE to distinguish this case, so I added handling logic for this and made Envoy drop the datagrams instead of resetting the stream.

Also, Envoy was dropping Datagrams because the default maximum packet length for QUIC connections in QUICHE is not large enough for tunneling use cases such as CONNECT-UDP. I added a new QUIC protocol option called max_packet_length to allow users to adjust the maximum packet length for upstream QUIC connections to fix this issue.

Additional Description:
Risk Level: Low, this change is only relevant if CONNECT-UDP is enabled with the forwarding mode.
Testing: Added more unit tests.
Docs Changes: Added the max_packet_length QUIC protocol option and its explanation.
Release Notes: Added notes about fixing the CONNECT-UDP forwarding mode and adding the new QUIC protocol option.
Platform Specific Features: N/A
[Optional Fixes #Issue]: #34836

When Envoy operates as a CONNECT-UDP forwarding proxy, it was resetting
the upstream stream because it received HTTP Datagrams before receiving
the SETTINGS frame. A new enum has been added in QUICHE to distinguish
this case, so I added handling logic for this and made Envoy drop the
datagrams instead of resetting the stream.

Also, Envoy was dropping Datagrams because the default maximum packet
length for QUIC connections in QUICHE is not large enough for tunneling
use cases such as CONNECT-UDP. I made the cluster manager override the
maximum packet length for upstream QUIC connections to fix this issue,
but only when the downstream request is CONNECT-UDP.

Signed-off-by: Jeongseok Son <[email protected]>
@jeongseokson

Copy link
Copy Markdown
Contributor Author

/wait

@zuercher

Copy link
Copy Markdown
Member

If this is a work-in-progress, please set the status to draft until you're ready for review.

@jeongseokson
jeongseokson marked this pull request as draft September 17, 2024 16:35
@jeongseokson

Copy link
Copy Markdown
Contributor Author

/retest

@jeongseokson
jeongseokson marked this pull request as ready for review September 17, 2024 22:23
@jeongseokson

Copy link
Copy Markdown
Contributor Author

Hi Ryan, could you review the update on the HTTP Datagram Handler?
/assign @RyanTheOptimist

Hi Dan, I made some changes in quic_info to set different max packet lengths for QUIC connections if the downstream is CONNECT-UDP. Could you review the changes I made under the QUIC component?
/assign @danzh2010

@DavidSchinazi DavidSchinazi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM modulo the open comment thread

@repokitteh-read-only

Copy link
Copy Markdown

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

🐱

Caused by: #36174 was synchronize by jeongseokson.

see: more, trace.


// Maximum packet length for QUIC connections. It refers to the largest size of a QUIC packet that can be transmitted over the connection.
// If not specified, the default value defined in `QUICHE <https://github.com/google/quiche/blob/main/quiche/quic/core/quic_constants.h>` is used.
google.protobuf.UInt64Value max_packet_length = 9;

@jeongseokson jeongseokson Sep 19, 2024 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the comments, @RyanTheOptimist and @DavidSchinazi. I will send more commits soon but want to quickly check if we should set a reasonable bound for the max_packet_length option like other options in this config. One range I can think of is 1 <= max_packet_length <= 65,535 (max IP packet size), but I'm wondering if we should just not set the bound here. I used UInt64Value since the corresponding QUICHE variable and constants (e.g. https://github.com/google/quiche/blob/4249f8025caed1e3d71d04d9cadf42251acb7cac/quiche/quic/core/quic_constants.h#L32) use QuicByteCount, which is uint64_t internally. Let me know if you have any thoughts on these.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think Envoy needs to put a cap on this value. Internally, QUICHE will cap it at 1452, but we shouldn't duplicate that constant or logic here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

SGTM. Let me know if you have any other comments on the new code.

@RyanTheOptimist

Copy link
Copy Markdown
Contributor

/wait

Signed-off-by: Jeongseok Son <[email protected]>
Locally ran the doc CI this time.

Signed-off-by: Jeongseok Son <[email protected]>
abeyad
abeyad previously approved these changes Sep 20, 2024

@abeyad abeyad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm api

@jeongseokson

Copy link
Copy Markdown
Contributor Author

/wait on CI

@jeongseokson

Copy link
Copy Markdown
Contributor Author

@RyanTheOptimist, @DavidSchinazi Let me know if you have more comments, @abeyad I made your approval obsolete so will appreciate it if you can LGTM again, thank you.

@RyanTheOptimist

Copy link
Copy Markdown
Contributor

@abeyad, over to you, I think!

@abeyad abeyad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm api

@jeongseokson

Copy link
Copy Markdown
Contributor Author

It passed the CI, but I'm not sure how to remove the waiting label. Can anyone with write access merge this PR? Thank you.

@RyanTheOptimist
RyanTheOptimist merged commit 0e7fdf5 into envoyproxy:main Sep 23, 2024
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.

6 participants