From dd7b7d76e8fe9ca40ec82e9e7c7de33154390500 Mon Sep 17 00:00:00 2001 From: dmiller Date: Mon, 10 Feb 2025 20:32:48 +0000 Subject: [PATCH] socket_bindtodevice: make whole function conditional on SO_BINDTODEVICE definition --- nbase/nbase_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nbase/nbase_misc.c b/nbase/nbase_misc.c index 3c8f96439..5926eb406 100644 --- a/nbase/nbase_misc.c +++ b/nbase/nbase_misc.c @@ -264,6 +264,7 @@ int block_socket(int sd) { /* Use the SO_BINDTODEVICE sockopt to bind with a specific interface (Linux only). Pass NULL or an empty string to remove device binding. */ int socket_bindtodevice(int sd, const char *device) { +#ifdef SO_BINDTODEVICE char padded[sizeof(int)]; size_t len; @@ -281,7 +282,6 @@ int socket_bindtodevice(int sd, const char *device) { len = sizeof(padded); } -#ifdef SO_BINDTODEVICE /* Linux-specific sockopt asking to use a specific interface. See socket(7). */ if (setsockopt(sd, SOL_SOCKET, SO_BINDTODEVICE, device, len) < 0) return 0;