Skip to content

Fix UQUICConn Close after cancellation and preset transport parameters - #425

Open
StarProxima wants to merge 1 commit into
refraction-networking:masterfrom
StarProxima:fix/uquic-close-and-preset-params
Open

StarProxima wants to merge 1 commit into
refraction-networking:masterfrom
StarProxima:fix/uquic-close-and-preset-params

Conversation

@StarProxima

Copy link
Copy Markdown

Two UQUICConn problems that show up when uTLS is used under a QUIC stack (we hit them with Xray's Hysteria transport after moving to the Chrome 155 preset):

1. Close hangs after the handshake context is canceled. Since the crypto/tls fix for golang/go#77274 (synced here in 23b5a72), QUICConn.Close waits on signalc after cancel(), because cancellation is now processed only inside a user call. UQUICConn.Close was not updated and still drains blockedc right away, so the handshake goroutine never gets the signal it is waiting for and Close blocks forever.

2. SetTransportParameters does not reach the peer when a preset is applied. The parameters were stored only in quic.transportParams, which a preset ClientHello does not use (the code had a commented-out loop for this). Since ApplyPreset clones the spec, the QUICTransportParametersExtension that gets marshaled is the clone, so callers cannot fix it from the outside either. The change stores the parameters in that extension.

Both are covered by new tests in u_quic_preset_test.go, modeled on TestUQUICDefaultMinVersion and Go's TestQUICContextCancelation:

  • TestUQUICPresetTransportParameters: without the change the server receives empty transport parameters;
  • TestUQUICContextCancelation: without the change it hangs until the test timeout.

With the change, go test -race -run 'TestUQUIC|TestQUIC' and the full go test pass.

UQUICConn.Close did not wait on signalc after canceling the handshake, as
QUICConn.Close does since crypto/tls fixed golang/go#77274 (23b5a72).
Closing a UQUICConn whose context was canceled during the handshake could
block forever.

SetTransportParameters only set quic.transportParams, which a ClientHello
built from a preset does not use: ApplyPreset clones the spec, so the
QUICTransportParametersExtension that is marshaled is the clone. The
parameters never reached the peer. Store them in that extension.

TestUQUICPresetTransportParameters and TestUQUICContextCancelation fail
without the change: the server receives empty transport parameters, and
the cancellation test hangs.
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