Wrap SO_BINDTODEVICE with the correct capability

This commit is contained in:
Jan Synacek 2012-11-13 13:12:36 +01:00
parent 317683087f
commit 2be9453c6f
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,20 @@
--- iputils-s20121112/ping.c.orig 2012-11-13 12:54:16.000000000 +0100
+++ iputils-s20121112/ping.c 2012-11-13 12:59:42.800466410 +0100
@@ -314,9 +314,16 @@ main(int argc, char **argv)
}
if (device) {
struct ifreq ifr;
+ int rc;
+
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, device, IFNAMSIZ-1);
- if (setsockopt(probe_fd, SOL_SOCKET, SO_BINDTODEVICE, device, strlen(device)+1) == -1) {
+
+ enable_capability_raw();
+ rc = setsockopt(probe_fd, SOL_SOCKET, SO_BINDTODEVICE, device, strlen(device)+1);
+ disable_capability_raw();
+
+ if (rc == -1) {
if (IN_MULTICAST(ntohl(dst.sin_addr.s_addr))) {
struct ip_mreqn imr;
if (ioctl(probe_fd, SIOCGIFINDEX, &ifr) < 0) {

View File

@ -25,6 +25,8 @@ Patch12: iputils-20100418-convtoint.patch
Patch15: iputils-20101006-unused.patch Patch15: iputils-20101006-unused.patch
# Use getifaddrs() instead of this? # Use getifaddrs() instead of this?
Patch17: iputils-20101006-eth.patch Patch17: iputils-20101006-eth.patch
# Accepted upstream, will be in the next release
Patch18: iputils-s20121112-sobindtodevice-capability.patch
BuildRequires: docbook-utils perl-SGMLSpm BuildRequires: docbook-utils perl-SGMLSpm
BuildRequires: glibc-kernheaders >= 2.4-8.19 BuildRequires: glibc-kernheaders >= 2.4-8.19
@ -72,6 +74,7 @@ The iputils-sysvinit contains SysV initscritps support.
%patch12 -p1 -b .convtoint %patch12 -p1 -b .convtoint
%patch15 -p1 -b .unused %patch15 -p1 -b .unused
%patch17 -p1 -b .eth %patch17 -p1 -b .eth
%patch18 -p1 -b .bindtodevice-cap
%build %build
%ifarch s390 s390x %ifarch s390 s390x
@ -158,6 +161,7 @@ mv -f RELNOTES.tmp RELNOTES
- Update to iputils-s20121112 (#875767) - Update to iputils-s20121112 (#875767)
+ drop unnecessary patches + drop unnecessary patches
+ update patches + update patches
+ wrap SO_BINDTODEVICE with the correct capability
* Thu Nov 08 2012 Jan Synáček <jsynacek@redhat.com> - 20121106-2 * Thu Nov 08 2012 Jan Synáček <jsynacek@redhat.com> - 20121106-2
- Update ifenslave tarball (#859182) - Update ifenslave tarball (#859182)