alta / swift-quic-datagram-example

Swift QUIC datagram example
8 stars 0 forks source link

macOS 12.0 beta does not set the max_datagram_payload_size transport parameter #1

Open ydnar opened 3 years ago

ydnar commented 3 years ago

Radar link: rdar://79423130

As of build 21A5248p, the QUIC implementation in macOS 12 does not send the 0x20 (max_datagram_payload_size or max_datagram_frame_size) transport parameter.

The Go server interprets this as missing or 0, and therefore does not support sending datagram frames on the opened connection.

The qlog output for client transport parameters:

[
    31323793095,
    "TRANSPORT",
    "PARAMETERS_SET",
    {
        "ack_delay_exponent": 0,
        "active_connection_id_limit": 64,
        "disable_active_migration": "false",
        "initial_max_data": 2097152,
        "initial_max_stream_data_bidi_local": 131072,
        "initial_max_stream_data_bidi_remote": 131072,
        "initial_max_stream_data_uni": 131072,
        "initial_max_streams_bidi": 8,
        "initial_max_streams_uni": 8,
        "initial_source_connection_id": "",
        "max_ack_delay": 3,
        "max_idle_timeout": 30000,
        "max_udp_payload_size": 65527,
        "original_destination_connection_id": "",
        "owner": "local",
        "retry_source_connection_id": "",
        "tls_cipher": ""
    }
]
ydnar commented 3 years ago

If the server ignores max_datagram_frame_size and sends a datagram anyway, Apple’s QUIC rejects it with a protocol error: DATAGRAM frame size too big.

Network.framework is aware of the datagram draft, but looks like support is not exposed in the current seed.

ydnar commented 3 years ago

When built with Xcode 12 beta 2, swift test emits the following error:

Symbol not found: _$s7Network16NWMultiplexGroupC2toAcA10NWEndpointO_tcfC
  Referenced from: .build/x86_64-apple-macosx/debug/SwiftQUICDatagramExamplePackageTests.xctest/Contents/MacOS/SwiftQUICDatagramExamplePackageTests
  Expected in: /usr/lib/swift/libswiftNetwork.dylib)

Looks like the initializer for NWMultiplexGroup(to: endpoint) is missing from macOS 12 beta 1?

Edit: the file /usr/lib/swift/libswiftNetwork.dylib doesn’t exist.

ydnar commented 3 years ago

Update: this can be compiled and run on macOS 12 beta 2, which was released earlier today.