Hi, Unlike the manpage saids or one might think , sendto(2) sets errno to EHOSTUNREACH instead of EACCES in cases of blocking by pf(4) or not enabled broadcasts. Finally I ran into both cases and think, its time to fix this issue. The diff suggests a new explanation that should cover all error cases.
Bye, Jan Index: /usr/src/lib/libc/sys/send.2 =================================================================== RCS file: /cvs/src/lib/libc/sys/send.2,v retrieving revision 1.32 diff -u -p -r1.32 send.2 --- /usr/src/lib/libc/sys/send.2 5 Oct 2017 12:30:16 -0000 1.32 +++ /usr/src/lib/libc/sys/send.2 28 Oct 2018 20:16:20 -0000 @@ -161,13 +161,13 @@ The operation may succeed when buffers b The output queue for a network interface was full. This generally indicates that the interface has stopped sending, but may be caused by transient congestion. -.It Bq Er EACCES -The -.Dv SO_BROADCAST -option is not set on the socket, and a broadcast address -was given as the destination. .It Bq Er EHOSTUNREACH -The destination address specified an unreachable host. +The destination address specified an host that is unreachable, +blocked by +.Xr pf 4 +or is broadcast communication which was not enabled +via the socket option +.Dv SO_BROADCAST . .It Bq Er EINVAL The .Fa flags