From dillon at crater.dragonflybsd.org Tue Nov 5 08:13:35 2024 From: dillon at crater.dragonflybsd.org (Matthew Dillon) Date: Tue, 5 Nov 2024 08:13:35 -0800 (PST) Subject: git: kernel - Fix auto port assignment collision in network code Message-ID: <20241105161335.444ED2816738@crater.dragonflybsd.org> commit 84646c2989fb6978ded9d3ce41be1628389b376a Author: Matthew Dillon Date: Tue Nov 5 08:05:14 2024 -0800 kernel - Fix auto port assignment collision in network code * When the SO_REUSEADDR or SO_REUSEPORT socket option is set on a socket undergoing automatic lport assignment, the auto network port assignment code in the kernel improperly ignores collisions against ports assigned to wildcard sockets and may assign the same port. This causes later connect() calls to fail. * Can cause gdb services to sometimes fail to connect. * Fixed by ignoring the options for the purposes of finding an unused port. Reported-by: Sergey Zigachev (servik) Summary of changes: sys/netinet/in_pcb.c | 7 +++++++ sys/netinet6/in6_src.c | 10 ++++++++++ 2 files changed, 17 insertions(+) http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/84646c2989fb6978ded9d3ce41be1628389b376a -- DragonFly BSD source repository