TritonDataCenter / illumos-joyent

Community developed and maintained version of the OS/Net consolidation
http://www.illumos.org/projects/illumos-gate
265 stars 111 forks source link

OS-8553 LX TCP_INFO socket option needs to be more strict #475

Closed danmcd closed 1 week ago

danmcd commented 1 week ago

Discovered by @smokris --> this patch improves the insufficient checking.

danmcd commented 1 week ago

This may be useful for OmniOS too, @citrus-it

danmcd commented 1 week ago

Tested with checks that show error numbers are returned appropriate. a.out tests AF_UNIX, udp.out tests AF_INET6/SOCK_DGRAM:


# uname -a
Linux 93c0ec62-af01-4070-aacd-9e42a0410000 5 BrandZ virtual linux x86_64 GNU/Linux
# ./a.out ; ./udp.out
fd=3
ret=-1, errnor = 95 (Operation not supported)
fd=3
ret=-1, errno == 92 (Protocol not available)
#