* [PATCH] ping: Wrap SO_BINDTODEVICE with the correct capability.
@ 2012-11-12 13:11 Jan Synacek
2012-11-12 15:25 ` YOSHIFUJI Hideaki
0 siblings, 1 reply; 2+ messages in thread
From: Jan Synacek @ 2012-11-12 13:11 UTC (permalink / raw)
To: yoshfuji; +Cc: netdev
Signed-off-by: Jan Synacek <jsynacek@redhat.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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ping: Wrap SO_BINDTODEVICE with the correct capability.
2012-11-12 13:11 [PATCH] ping: Wrap SO_BINDTODEVICE with the correct capability Jan Synacek
@ 2012-11-12 15:25 ` YOSHIFUJI Hideaki
0 siblings, 0 replies; 2+ messages in thread
From: YOSHIFUJI Hideaki @ 2012-11-12 15:25 UTC (permalink / raw)
To: Jan Synacek; +Cc: netdev, YOSHIFUJI Hideaki
Jan Synacek wrote:
>
> Signed-off-by: Jan Synacek <jsynacek@redhat.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 &&
>
Oh, you're right. Applied, thank you.
--yoshfuji
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-12 15:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-12 13:11 [PATCH] ping: Wrap SO_BINDTODEVICE with the correct capability Jan Synacek
2012-11-12 15:25 ` YOSHIFUJI Hideaki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).