From a2bd14115cd20b92153e79d1a2962a0fbb74a39f Mon Sep 17 00:00:00 2001 From: Robert Vollmer Date: Wed, 10 Aug 2022 11:15:55 +0200 Subject: [PATCH] Check if SO_BINDTODEVICE is defined --- packet/construct_unix.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packet/construct_unix.c b/packet/construct_unix.c index 65f0b63..e78228a 100644 --- a/packet/construct_unix.c +++ b/packet/construct_unix.c @@ -398,12 +398,14 @@ int set_stream_socket_options( } #endif +#ifdef SO_BINDTODEVICE if (param->local_device) { if (setsockopt(stream_socket, SOL_SOCKET, SO_BINDTODEVICE, param->local_device, strlen(param->local_device))) { return -1; } } +#endif return 0; } @@ -621,12 +623,14 @@ int construct_ip4_packet( } #endif +#ifdef SO_BINDTODEVICE if (param->local_device) { if (setsockopt(send_socket, SOL_SOCKET, SO_BINDTODEVICE, param->local_device, strlen(param->local_device))) { return -1; } } +#endif /* Bind src port when not using raw socket to pass in ICMP id, kernel @@ -796,6 +800,7 @@ int construct_ip6_packet( } #endif +#ifdef SO_BINDTODEVICE if (param->local_device) { if (setsockopt(send_socket, SOL_SOCKET, SO_BINDTODEVICE, param->local_device, @@ -803,6 +808,7 @@ int construct_ip6_packet( return -1; } } +#endif return 0; } -- 2.47.2