From: Jan Synacek <jsynacek@redhat.com>
To: yoshfuji@linux-ipv6.org
Cc: netdev@vger.kernel.org
Subject: [PATCH] ping: Wrap SO_BINDTODEVICE with the correct capability.
Date: Mon, 12 Nov 2012 14:11:12 +0100 [thread overview]
Message-ID: <50A0F570.5090208@redhat.com> (raw)
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
next reply other threads:[~2012-11-12 13:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-12 13:11 Jan Synacek [this message]
2012-11-12 15:25 ` [PATCH] ping: Wrap SO_BINDTODEVICE with the correct capability YOSHIFUJI Hideaki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50A0F570.5090208@redhat.com \
--to=jsynacek@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).