forked from acouzens/open5gs
Change EPERM to OGS_EPERM (#1436,#1404)
This commit is contained in:
parent
f060da45d5
commit
a6ec206998
|
@ -32,6 +32,7 @@ extern "C" {
|
||||||
|
|
||||||
typedef DWORD ogs_err_t;
|
typedef DWORD ogs_err_t;
|
||||||
|
|
||||||
|
#define OGS_EPERM ERROR_ACCESS_DENIED
|
||||||
#define OGS_ENOMEM ERROR_NOT_ENOUGH_MEMORY
|
#define OGS_ENOMEM ERROR_NOT_ENOUGH_MEMORY
|
||||||
#define OGS_EACCES ERROR_ACCESS_DENIED
|
#define OGS_EACCES ERROR_ACCESS_DENIED
|
||||||
#define OGS_EEXIST ERROR_ALREADY_EXISTS
|
#define OGS_EEXIST ERROR_ALREADY_EXISTS
|
||||||
|
@ -51,6 +52,7 @@ typedef DWORD ogs_err_t;
|
||||||
|
|
||||||
typedef int ogs_err_t;
|
typedef int ogs_err_t;
|
||||||
|
|
||||||
|
#define OGS_EPERM EPERM
|
||||||
#define OGS_ENOMEM ENOMEM
|
#define OGS_ENOMEM ENOMEM
|
||||||
#define OGS_EACCES EACCES
|
#define OGS_EACCES EACCES
|
||||||
#define OGS_EEXIST EEXIST
|
#define OGS_EEXIST EEXIST
|
||||||
|
|
|
@ -184,10 +184,10 @@ int ogs_bind_to_device(ogs_socket_t fd, const char *device)
|
||||||
ogs_debug("SO_BINDTODEVICE:[%s]", device);
|
ogs_debug("SO_BINDTODEVICE:[%s]", device);
|
||||||
rc = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, device, strlen(device)+1);
|
rc = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, device, strlen(device)+1);
|
||||||
if (rc != OGS_OK) {
|
if (rc != OGS_OK) {
|
||||||
int err = errno;
|
int err = ogs_errno;
|
||||||
ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno,
|
ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno,
|
||||||
"setsockopt(SOL_SOCKET, SO_BINDTODEVICE, %s) failed", device);
|
"setsockopt(SOL_SOCKET, SO_BINDTODEVICE, %s) failed", device);
|
||||||
if (err == EPERM)
|
if (err == OGS_EPERM)
|
||||||
ogs_error("You need to grant CAP_NET_RAW privileges to use SO_BINDTODEVICE.");
|
ogs_error("You need to grant CAP_NET_RAW privileges to use SO_BINDTODEVICE.");
|
||||||
return OGS_ERROR;
|
return OGS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue