lib/socket: detect protocol in nl_socket_set_fd()
lib/socket: detect protocol in nl_socket_set_fd()

With support for socket option SO_PROTOCOL we don't need the protocol
argument to nl_socket_set_fd(). Maybe we should drop the protocol argument
and just not support nl_socket_set_fd() on older systems. But instead
keep the argument and allow passing -1 to autodetect it.

If the user sets a protocol option, we check via getsockopt() that the
value is correct and error out otherwise.

On older kernels, the user must set the value. Otherwise
nl_socket_set_fd() will fail.

Signed-off-by: Thomas Haller <16e26612e4159990a6b3691e92592e691ff74132@redhat.com>

HolyShitMan/libnl-1,thom311/libnl,honsys/libnl,congwang/libnl,congwang/libnl,cfriedt/libnl,dsahern/libnl,claudelee/libnl,HolyShitMan/libnl-1,houstar/libnl,dsahern/libnl,kolyshkin/libnl,claudelee/libnl,tklauser/libnl,tklauser/libnl,HolyShitMan/libnl-1,honsys/libnl,mshirley/libnl,greearb/libnl-ct,kolyshkin/libnl,congwang/libnl,cfriedt/libnl,honsys/libnl,tgraf/libnl,greearb/libnl-ct,baloo/libnl,mshirley/libnl,congwang/libnl,houstar/libnl,baloo/libnl,kolyshkin/libnl,cfriedt/libnl,tgraf/libnl,tgraf/libnl,claudelee/libnl,houstar/libnl,greearb/libnl-ct,tklauser/libnl,mshirley/libnl,thom311/libnl,claudelee/libnl,kolyshkin/libnl,tklauser/libnl,thom311/libnl,mshirley/libnl,cfriedt/libnl,baloo/libnl,honsys/libnl,dsahern/libnl,tgraf/libnl,HolyShitMan/libnl-1,dsahern/libnl,houstar/libnl,baloo/libnl