Kernel 4.16 introduces SMC IPv6 protocol, defines SMCPROTO_SMC6 as 1.
So, socket(43 /* AF_HYPERV */, SOCK_STREAM, 1 /* HV_PROTOCOL_RAW */)
does no longer fail, gives false-positive presense of Hyper-V socket
support.
Fix this by getting and checking exact socket name size, it should be
different for AF_SMC/SMCPROTO_SMC6 and AF_HYPERV/HV_PROTOCOL_RAW.
Also, non-standard Linux extension accept4() required _GNU_SOURCE to be defined.
If not, following warnings are expected:
hvsock_linux.go: In function ‘accept_hv’:
hvsock_linux.go:33:12: warning: implicit declaration of function ‘accept4’
If flags is 0 then accept4() is the same as accept(), so in this case let's
use accept() and get rid of warnings.
Kernel 4.16 introduces SMC IPv6 protocol, defines SMCPROTO_SMC6 as 1. So,
socket(43 /* AF_HYPERV */, SOCK_STREAM, 1 /* HV_PROTOCOL_RAW */)
does no longer fail, gives false-positive presense of Hyper-V socket support.Fix this by getting and checking exact socket name size, it should be different for AF_SMC/SMCPROTO_SMC6 and AF_HYPERV/HV_PROTOCOL_RAW.
Also, non-standard Linux extension accept4() required _GNU_SOURCE to be defined. If not, following warnings are expected: hvsock_linux.go: In function ‘accept_hv’: hvsock_linux.go:33:12: warning: implicit declaration of function ‘accept4’
If flags is 0 then accept4() is the same as accept(), so in this case let's use accept() and get rid of warnings.