ping: Wrap SO_BINDTODEVICE with the correct capability.
Subsystems (2)
PATCH 1/1 ping: Wrap SO_BINDTODEVICE with the correct capability.
Signed-off-by Jan Synacek <[email protected]>
--- ping.c | 5 +++++ 1 file changed, 5 insertions(+)
ping.c +3 -0
@@ -316,6 +316,9 @@ main(int argc, char **argv)struct ifreq ifr;memset (&ifr,0 ,sizeof (ifr));strncpy (ifr.ifr_name, device,IFNAMSIZ -1 ); + +enable_capability_raw (); + if (setsockopt(probe_fd, SOL_SOCKET, SO_BINDTODEVICE, device,
strlen(device)+1) == -1) {
if (IN_MULTICAST(ntohl(dst.sin_addr.s_addr))) {
struct ip_mreqn imr;
@@ -331,6 +334,8 @@ main(int argc, char **argv)
}
}
}
+
+ disable_capability_raw();
}
if (settos &&
Signature · 1 line
1.7.11.7
Quoted 23 lines · Jan Synacek
Signed-off-by Jan Synacek <[email protected]>--- ping.c | 5 +++++ 1 file changed, 5 insertions(+)ping.c +3
-0@@ -316,6 +316,9 @@ main(int argc, char **argv)struct ifreq ifr;memset (&ifr,0 ,sizeof (ifr));strncpy (ifr.ifr_name, device,IFNAMSIZ -1 ); + +enable_capability_raw (); +if (setsockopt (probe_fd,SOL_SOCKET ,SO_BINDTODEVICE , device,strlen (device)+1 ) ==-1 ) {if (IN_MULTICAST (ntohl (dst.sin_addr.s_addr))) {ping.c +0
-0struct ip_mreqn imr;
ping.c main(int argc, char **argv) · line 341
Quoted 8 lines
ping.c +2
-0@@ -331,6 +334,8 @@ main(int argc, char **argv) } } } + +disable_capability_raw (); } if (settos &&
Oh, you're right. Applied, thank you.
--yoshfuji