cloudflare/quiche · error

send_to_gso() should not be called on non-linux platforms

Error message

send_to_gso() should not be called on non-linux platforms

What it means

send_to_gso_pacing has a non-Linux stub that exists only to satisfy compilation on other platforms; calling it is a programming error because UDP GSO (UDP_SEGMENT/SO_TXTIME) is Linux-only. The function unconditionally panics if invoked on macOS/Windows/etc.

Solutions

  1. Run on Linux if GSO pacing is required; it depends on Linux-specific socket options.
  2. Ensure GSO/pacing options are disabled on non-Linux platforms.
  3. Verify the cfg(target_os) gating in apps/src/sendto.rs and its callers.
  4. Fall back to the plain send_to() path when GSO is unavailable.

Example fix

// before
send_to_gso_pacing(&socket, &buf, &send_info, segment_size)?; // on macOS
// after
if cfg!(target_os = "linux") {
    send_to_gso_pacing(&socket, &buf, &send_info, segment_size)?
} else {
    socket.send_to(&buf, &send_info.to)?
};
Defensive patterns

Strategy: validation

Validate before calling

fn gso_supported() -> bool { cfg!(target_os = "linux") }
if !gso_supported() { /* use plain socket.send_to() */ }

Prevention

When it happens

Trigger: The send path selects the GSO pacing function on a non-Linux target, e.g. due to a misconfigured feature flag or incorrect cfg gating in the caller, while GSO pacing is requested.

Common situations: Building/running tokio-quiche or apps with GSO enabled on macOS/BSD for development; platform-detection code accidentally enabling the Linux path.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of cloudflare/quiche@9f96daa2c2 (2026-09-08). Data as JSON: /api/errors/58f153a407154068. Report an issue: GitHub.

Appendix: source

Thrown at apps/src/sendto.rs:90

    match sendmsg(
        sockfd,
        &iov,
        &[cmsg_gso, cmsg_txtime],
        MsgFlags::empty(),
        Some(&dst),
    ) {
        Ok(v) => Ok(v),
        Err(e) => Err(e.into()),
    }
}

/// For non-Linux platforms.
#[cfg(not(target_os = "linux"))]
fn send_to_gso_pacing(
    _socket: &mio::net::UdpSocket, _buf: &[u8], _send_info: &quiche::SendInfo,
    _segment_size: usize,
) -> io::Result<usize> {
    panic!("send_to_gso() should not be called on non-linux platforms");
}

/// A wrapper function of send_to().
///
/// When GSO and SO_TXTIME are enabled, send packets using send_to_gso().
/// Otherwise, send packets using socket.send_to().
pub fn send_to(
    socket: &mio::net::UdpSocket, buf: &[u8], send_info: &quiche::SendInfo,
    segment_size: usize, pacing: bool, enable_gso: bool,
) -> io::Result<usize> {
    if pacing && enable_gso {
        match send_to_gso_pacing(socket, buf, send_info, segment_size) {
            Ok(v) => {
                return Ok(v);
            },
            Err(e) => {
                return Err(e);
            },

View on GitHub (pinned to 9f96daa2c2)