aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTom Jones <thj@freebsd.org>2024-01-26 14:54:57 +0000
committerDamjan Marion <dmarion@0xa5.net>2024-02-13 16:27:26 +0000
commit93fc6920fb089c4db7716aed3ed1efc617683646 (patch)
tree12901c5d890b8cfa1a5bc7e1adbbf2a86e794ca0 /src
parentb077d6678cc32c7f65d631b76fba5759692f880c (diff)
vppinfra: Protect Linux specific features behind CLIB_LINUX
Place Linux specific features behind CLIB_LINUX. The previous #ifdef calls would still pass even if CLIB_LINUX is set to 0 in clib.h, instead use #if. Type: improvement Change-Id: Ibe4424eee4bc0065f54764b017b9a56a3e854380 Signed-off-by: Tom Jones <thj@freebsd.org>
Diffstat (limited to 'src')
-rw-r--r--src/vppinfra/socket.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/vppinfra/socket.c b/src/vppinfra/socket.c
index dd447abfd64..2abf2b244cd 100644
--- a/src/vppinfra/socket.c
+++ b/src/vppinfra/socket.c
@@ -226,7 +226,7 @@ static clib_error_t *
default_socket_recvmsg (clib_socket_t * s, void *msg, int msglen,
int fds[], int num_fds)
{
-#ifdef CLIB_LINUX
+#if CLIB_LINUX
char ctl[CMSG_SPACE (sizeof (int) * num_fds) +
CMSG_SPACE (sizeof (struct ucred))];
struct ucred *cr = 0;
@@ -261,7 +261,7 @@ default_socket_recvmsg (clib_socket_t * s, void *msg, int msglen,
{
if (cmsg->cmsg_level == SOL_SOCKET)
{
-#ifdef CLIB_LINUX
+#if CLIB_LINUX
if (cmsg->cmsg_type == SCM_CREDENTIALS)
{
cr = (struct ucred *) CMSG_DATA (cmsg);
@@ -314,11 +314,13 @@ static const struct
.family = AF_INET,
.type = CLIB_SOCKET_TYPE_INET,
.skip_prefix = 1 },
+#if CLIB_LINUX
{ .prefix = "abstract:",
.family = AF_UNIX,
.type = CLIB_SOCKET_TYPE_LINUX_ABSTRACT,
.skip_prefix = 1,
.is_local = 1 },
+#endif /* CLIB_LINUX */
{ .prefix = "/",
.family = AF_UNIX,
.type = CLIB_SOCKET_TYPE_UNIX,