Open
Description
Describe the bug
It seems that the Linux port selection logic will (too) aggressively share local ports between both connected and unconnected sockets. The following happened in a recent test (causing a failure):
- Server (unbound) socket is started with no specified local port. Linux stack assigns port X as local port.
- Client (unbound) socket is created and then connected to port X. Linux stack also assigns port X as the local port.
- Client socket sends packet to Server.
- Client socket receives packet.
[0][3846.3846][07:15:39.400854][data][0x55ff8e028000] Created, local=[::]:0, remote=None
[0][3846.3846][07:15:39.401113][list][0x55ff8e026860] Started, Binding=0x55ff8e024a50, LocalAddr=*:41012, ALPN=MsQuicTest
[1][3846.384d][07:15:39.401545][data][0x7fe56c001e30] Created, local=None, remote=127.0.0.1:41012
[1][3846.384d][07:15:39.401642][conn][0x55ff8e0506a0] New Local IP: 127.0.0.1:41012
[1][3846.384d][07:15:39.401925][data][0x7fe56c001e30] Send 1220 bytes in 1 buffers (segment=1220) Dst=127.0.0.1:41012, Src=127.0.0.1:41012
[1][3846.384c][07:15:39.402035][data][0x7fe56c001e30] Recv 1220 bytes (segment=1220) Src=127.0.0.1:41012 Dst=127.0.0.1:41012
[1][3846.384c][07:15:39.402039][bind][0x7fe56c001470] DROP packet Dst=127.0.0.1:41012 Src=127.0.0.1:41012 Reason=No listeners registered to accept new connection..
Somehow we need to detect and prevent this from happening.
Affected OS
- All
- Windows Server 2022
- Windows 11
- Windows Insider Preview (specify affected build below)
- Ubuntu
- Debian
- Other (specify below)
MsQuic version
main / ALL
Steps taken to reproduce bug
- Run test on Linux
Expected behavior
The tests should pass
Actual outcome
Occasionally the tests fail because of shared ports assigned by the Linux stack.
Metadata
Metadata
Assignees
Type
Projects
Status
Should be written