On Mon, Oct 02, 2017 at 11:54:19AM -0600, Todd C. Miller wrote: > On Mon, 02 Oct 2017 19:05:37 +0200, Alexander Bluhm wrote: > > > Although I think the bug that syslogd was running into was failure > > in source address selection. Then the temporary bind failed as > > there was no suitable address. There is no "specified address". > > But the source address was specified in the sockaddr passed to > sendto(2), no?
No, sendto(2) gets the destination address from user land and the kernel tries to find a suitable source address. The automatic source address selection is the problem here. sendmsg(2) with IP_SENDSRCADDR could be used to specify the source address, but that is a very special new feature and syslogd(8) does not use it. > > Perhaps "No suitable address is available..." for both sendto(2) > > and connect(2) is more precise. And bind(2) talks about "the local > > machine". > > > > So I guess we should say "No suitable address is available on the > > local machine." > > If you think that is better, I have no real objection. I think it should be like this. Our kernel errnos are a bit inconsistent, but I think main cause for EADDRNOTAVAIL is when a local address is missing. ok? (after unlock) bluhm Index: lib/libc/sys/connect.2 =================================================================== RCS file: /data/mirror/openbsd/cvs/src/lib/libc/sys/connect.2,v retrieving revision 1.32 diff -u -p -r1.32 connect.2 --- lib/libc/sys/connect.2 2 Mar 2017 22:12:02 -0000 1.32 +++ lib/libc/sys/connect.2 2 Oct 2017 20:41:39 -0000 @@ -162,7 +162,7 @@ is not a valid descriptor. .Fa s is not a socket. .It Bq Er EADDRNOTAVAIL -The specified address is not available on this machine. +No suitable address is available on the local machine. .It Bq Er EAFNOSUPPORT Addresses in the specified address family cannot be used with this socket. .It Bq Er EISCONN Index: lib/libc/sys/send.2 =================================================================== RCS file: /data/mirror/openbsd/cvs/src/lib/libc/sys/send.2,v retrieving revision 1.31 diff -u -p -r1.31 send.2 --- lib/libc/sys/send.2 9 Sep 2014 06:32:37 -0000 1.31 +++ lib/libc/sys/send.2 2 Oct 2017 20:39:34 -0000 @@ -207,6 +207,8 @@ and .Fn sendmsg may return the following errors: .Bl -tag -width Er +.It Bq Er EADDRNOTAVAIL +No suitable address is available on the local machine. .It Bq Er EAFNOSUPPORT Addresses in the specified address family cannot be used with this socket. .It Bq Er EISCONN
