|
|
994c6b |
Resolves: #1351540
|
|
|
994c6b |
|
|
|
994c6b |
--- a/ping.c
|
|
|
994c6b |
+++ b/ping.c
|
|
|
994c6b |
@@ -569,6 +569,7 @@ int ping4_run(int argc, char **argv, struct addrinfo *ai, socket_st *sock)
|
|
|
994c6b |
strncpy(ifr.ifr_name, device, IFNAMSIZ-1);
|
|
|
994c6b |
|
|
|
994c6b |
enable_capability_raw();
|
|
|
994c6b |
+ setsockopt(sock->fd, SOL_SOCKET, SO_BINDTODEVICE, device, strlen(device)+1);
|
|
|
994c6b |
rc = setsockopt(probe_fd, SOL_SOCKET, SO_BINDTODEVICE, device, strlen(device)+1);
|
|
|
994c6b |
disable_capability_raw();
|
|
|
994c6b |
|
|
|
994c6b |
--- a/ping6_common.c
|
|
|
994c6b |
+++ b/ping6_common.c
|
|
|
994c6b |
@@ -797,8 +797,10 @@ int ping6_run(int argc, char **argv, struct addrinfo *ai, struct socket_st *sock
|
|
|
994c6b |
enable_capability_raw();
|
|
|
994c6b |
if (
|
|
|
994c6b |
#ifdef IPV6_RECVPKTINFO
|
|
|
994c6b |
+ setsockopt(sock->fd, IPPROTO_IPV6, IPV6_PKTINFO, &ipi, sizeof ipi) == -1 &&
|
|
|
994c6b |
setsockopt(probe_fd, IPPROTO_IPV6, IPV6_PKTINFO, &ipi, sizeof ipi) == -1 &&
|
|
|
994c6b |
#endif
|
|
|
994c6b |
+ setsockopt(sock->fd, SOL_SOCKET, SO_BINDTODEVICE, device, strlen(device)+1) == -1 &&
|
|
|
994c6b |
setsockopt(probe_fd, SOL_SOCKET, SO_BINDTODEVICE, device, strlen(device)+1) == -1) {
|
|
|
994c6b |
perror("setsockopt(SO_BINDTODEVICE)");
|
|
|
994c6b |
exit(2);
|