Skip to content

Unable to listen on certain ports (QUIC_STATUS_ADDRESS_IN_USE) #2891

@rzikm

Description

@rzikm

Describe the bug

Originally discovered in .NET: dotnet/runtime#71518
It is not possible to start MsQuic listener on certain port range (50000-50059), even though there is no process already listening on that port (the port is not show in netstat output). Binding a socket to this port works without issues.

A bit of debugging shows that the following WSAIoctl call returns WSAEADDRINUSE

WSAIoctl(
SocketProc->Socket,
SIO_ACQUIRE_PORT_RESERVATION,
&PortRange,
sizeof(PortRange),
&PortReservation,
sizeof(PortReservation),
&BytesReturned,
NULL,
NULL);

Affected OS

  • All
  • Windows Server 2022
  • Windows 11, version 22H2
  • Windows 11, version 21H2
  • Windows Insider Preview (specify affected build below)
  • Ubuntu
  • Debian
  • Other (specify below)

Additional OS information

Probably windows only

MsQuic version

main

Steps taken to reproduce bug

Attempt to start MsQuic listener on any port in range 50000-50059

Expected behavior

The listener is started and works as on any other port.

Actual outcome

MsQuicListenerStart returns QUIC_STATUS_ADDRESS_IN_USE

Additional details

I tried to search the net to see what is so special about these ports, and it turns out that there is something called Port Exclusion Ranges apparently affects this:

> netsh int ip show excludedportrange protocol=udp

Protocol udp Port Exclusion Ranges

Start Port    End Port
----------    --------
     50000       50059     *
     55642       55741
     63552       63651

* - Administered port exclusions.

Indeed, the other two ranges are also impossible to listen on using MsQuic

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions