From: Robert Vollmer Date: Wed, 10 Aug 2022 09:15:55 +0000 (+0200) Subject: Check if SO_BINDTODEVICE is defined X-Git-Tag: v0.96~32^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F443%2Fhead;p=thirdparty%2Fmtr.git Check if SO_BINDTODEVICE is defined --- 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; }