bind(2) fails on 13.0-STABLE when sin_family is 0

From: Bakul Shah <bakul_at_iitbombay.org>
Date: Fri, 28 May 2021 14:40:26 -0700
ttcp runs fine on 13.0-RELEASE but fails on -stable.

The culprit seems to be bind(2). Running ttcp under gdb:

$ gdb a.out
Reading symbols from a.out...
(gdb) b 295
Breakpoint 1 at 0x203127: file ttcp.c, line 295.
(gdb) run -s -r
Starting program: /usr/ports/benchmarks/ttcp/work/ttcp-1.12_2/a.out -s -r
ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp
ttcp-r: socket

Breakpoint 1, main (argc=3, argv=0x7fffffffd9b0) at ttcp.c:295
295             if (bind(fd, (struct sockaddr *) &sinme, sizeof(sinme)) < 0)
(gdb) p/x sinme
$1 = {sin_len = 0x0, sin_family = 0x0, sin_port = 0x8913, sin_addr = {
   s_addr = 0x0}, sin_zero = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
(gdb) n
296                     err("bind");
(gdb) p errno
$2 = 47


$ errno 47
#define EAFNOSUPPORT    47              /* Address family not supported by protocol family */

Did something change post 13.0-RELEASE that requires specifying sin_family?
Thanks!

-- Bakul
Received on Fri May 28 2021 - 21:40:26 UTC

Original text of this message