[CORE] Improve SO_BINDTODEVICE error log line (#1436)

This commit is contained in:
Pau Espin Pedrol
2022-03-16 03:25:21 +01:00
committed by GitHub
parent bcf53124d5
commit 80ce991aa6

View File

@@ -184,9 +184,11 @@ int ogs_bind_to_device(ogs_socket_t fd, const char *device)
ogs_debug("SO_BINDTODEVICE:[%s]", device);
rc = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, device, strlen(device)+1);
if (rc != OGS_OK) {
int err = errno;
ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno,
"setsockopt(SOL_SOCKET, SO_BINDTODEVICE, %s) failed", device);
ogs_error("You need to grant privileges to use SO_BINDTODEVICE.");
if (err == EPERM)
ogs_error("You need to grant CAP_NET_RAW privileges to use SO_BINDTODEVICE.");
return OGS_ERROR;
}
#endif