Skip to content

IPv6 link-local addresses lose scope ID during address conversion, causing EINVAL on connect #147

Description

@mihai-chiorean

When using .dns() targets with IPv6 link-local addresses (e.g., fe80::1%eth0), the connection fails with EINVAL (errno 22) because the scope ID is silently dropped during address conversion.

IPv6 link-local addresses require a scope ID to identify which network interface to route through. Without it, the kernel rejects the connect() call.

How to reproduce

let transport = try HTTP2ClientTransport.Posix(
    target: .dns(host: "fe80::1%eth0", port: 50051),
    transportSecurity: .plaintext
)
// Fails with: connect(descriptor:addr:size:): Invalid argument (errno: 22)

Environment

  • grpc-swift-nio-transport 2.x
  • Linux (Glibc), tested on x86_64 and aarch64 (Jetson)
  • USB CDC NCM gadget networking with IPv6 link-local only connectivity

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions