[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <50A0F570.5090208@redhat.com>
Date: Mon, 12 Nov 2012 14:11:12 +0100
From: Jan Synacek <jsynacek@...hat.com>
To: yoshfuji@...ux-ipv6.org
CC: netdev@...r.kernel.org
Subject: [PATCH] ping: Wrap SO_BINDTODEVICE with the correct capability.
Signed-off-by: Jan Synacek <jsynacek@...hat.com>
---
ping.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/ping.c b/ping.c
index 2f70cec..c958f1a 100644
--- a/ping.c
+++ b/ping.c
@@ -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 &&
--
1.7.11.7
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists