socket: add support for binding sockets to device

As a Linux-specific feature, allow sockets to be bound to a device using
the SO_BINDTODEVICE socket option. The CAP_NET_RAW capability is
required for setting the option.
This commit is contained in:
Miroslav Lichvar
2020-06-30 10:21:45 +02:00
parent 0f04baeb97
commit 4ef944b734
9 changed files with 45 additions and 20 deletions

View File

@@ -325,7 +325,7 @@ NKC_Start(NKC_Instance inst)
local_addr.port = 0;
sock_fd = SCK_OpenTcpSocket(&inst->address, &local_addr, 0);
sock_fd = SCK_OpenTcpSocket(&inst->address, &local_addr, NULL, 0);
if (sock_fd < 0)
return 0;