Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 May 2021 14:40:26 -0700
From:      Bakul Shah <bakul@iitbombay.org>
To:        freebsd-net@freebsd.org
Subject:   bind(2) fails on 13.0-STABLE when sin_family is 0
Message-ID:  <D9E4EE46-E813-44F4-8BC2-971E1439A68D@iitbombay.org>

next in thread | raw e-mail | index | archive | help

--Apple-Mail=_4D4E7E14-7192-483F-AD71-C5F2492D91AA
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

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=3D8192, nbuf=3D2048, align=3D16384/0, port=3D5001  tcp
ttcp-r: socket

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


--Apple-Mail=_4D4E7E14-7192-483F-AD71-C5F2492D91AA--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D9E4EE46-E813-44F4-8BC2-971E1439A68D>