]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
fix(packet): retain bind-to-device capability 604/head
authorDarafei Praliaskouski <me@komzpa.net>
Thu, 7 May 2026 21:50:58 +0000 (01:50 +0400)
committerDarafei Praliaskouski <me@komzpa.net>
Thu, 7 May 2026 21:50:58 +0000 (01:50 +0400)
packet/construct_unix.c
packet/packet.c

index f86fd5279cd1a8e45a23f6928ea596a6cb001be4..6362c1a884b4b85d87557157d651dbefc5dd6555 100644 (file)
@@ -882,9 +882,7 @@ int construct_ip6_packet(
 
 #ifdef SO_BINDTODEVICE
     if (param->local_device) {
-        if (setsockopt(send_socket,
-                       SOL_SOCKET, SO_BINDTODEVICE, param->local_device,
-                       strlen(param->local_device))) {
+        if (set_bind_to_device(send_socket, param->local_device)) {
             return -1;
         }
     }
index 5f3a39b47b24b5f02277d272b07e1625ffa8de4f..9721b5b01d61b1e824e8353ab6c0797a3e79c3de 100644 (file)
@@ -28,6 +28,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
 
 #ifdef HAVE_LIBCAP
 #include <sys/capability.h>