rpms/iputils/F-9 iputils-20020927-arping-infiniband.patch, 1.3, 1.4 iputils.spec, 1.60, 1.61
Jiri Skala
jskala at fedoraproject.org
Fri Sep 5 06:17:39 UTC 2008
Author: jskala
Update of /cvs/extras/rpms/iputils/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv2374
Modified Files:
iputils-20020927-arping-infiniband.patch iputils.spec
Log Message:
* Thu Sep 04 2008 Jiri Skala <jskala at redhat.com> - 20071127-3
- removed a dependency on libsysfs library in arping
- Resolves: #455713 remove suid from ping
- corrected typing error in man
iputils-20020927-arping-infiniband.patch:
Index: iputils-20020927-arping-infiniband.patch
===================================================================
RCS file: /cvs/extras/rpms/iputils/F-9/iputils-20020927-arping-infiniband.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- iputils-20020927-arping-infiniband.patch 18 Feb 2008 16:10:01 -0000 1.3
+++ iputils-20020927-arping-infiniband.patch 5 Sep 2008 06:17:39 -0000 1.4
@@ -1,27 +1,7 @@
-diff -up iputils-s20070202/Makefile.infiniband iputils-s20070202/Makefile
---- iputils-s20070202/Makefile.infiniband 2008-02-18 16:47:39.000000000 +0100
-+++ iputils-s20070202/Makefile 2008-02-18 16:47:39.000000000 +0100
-@@ -37,6 +37,8 @@ rdisc_srv: rdisc_srv.o
- rdisc_srv.o: rdisc.c
- $(CC) $(CFLAGS) -DRDISC_SERVER -o rdisc_srv.o rdisc.c
-
-+arping: arping.o
-+ $(CC) $(LDFLAGS) arping.o $(LOADLIBES) $(LDLIBS) -lsysfs -o arping
-
- check-kernel:
- ifeq ($(KERNEL_INCLUDE),)
-diff -up iputils-s20070202/arping.c.infiniband iputils-s20070202/arping.c
---- iputils-s20070202/arping.c.infiniband 2008-02-18 16:47:39.000000000 +0100
-+++ iputils-s20070202/arping.c 2008-02-18 16:50:44.000000000 +0100
-@@ -31,6 +31,7 @@
- #include <string.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>
-+#include <sysfs/libsysfs.h>
-
- #include "SNAPSHOT.h"
-
-@@ -50,8 +51,13 @@ int unicasting;
+diff -up iputils-s20071127/arping.c.infiniband iputils-s20071127/arping.c
+--- iputils-s20071127/arping.c.infiniband 2007-11-27 01:57:27.000000000 +0100
++++ iputils-s20071127/arping.c 2008-08-08 10:05:04.000000000 +0200
+@@ -50,14 +50,26 @@ int unicasting;
int s;
int broadcast_only;
@@ -37,7 +17,20 @@
struct timeval start, last;
-@@ -124,7 +130,8 @@ int send_pack(int s, struct in_addr src,
+ int sent, brd_sent;
+ int received, brd_recv, req_recv;
+
++#define SYSFS_MNT_PATH "/sys"
++#define SYSFS_CLASS "class"
++#define SYSFS_NET "net"
++#define SYSFS_BROADCAST "broadcast"
++#define SYSFS_PATH_ENV "SYSFS_PATH"
++#define SYSFS_PATH_LEN 256
++
+ #define MS_TDIFF(tv1,tv2) ( ((tv1).tv_sec-(tv2).tv_sec)*1000 + \
+ ((tv1).tv_usec-(tv2).tv_usec)/1000 )
+
+@@ -124,7 +136,8 @@ int send_pack(int s, struct in_addr src,
p+=4;
gettimeofday(&now, NULL);
@@ -47,7 +40,7 @@
if (err == p-buf) {
last = now;
sent++;
-@@ -172,7 +179,7 @@ void catcher(void)
+@@ -172,7 +185,7 @@ void catcher(void)
finish();
if (last.tv_sec==0 || MS_TDIFF(tv,last) > 500) {
@@ -56,7 +49,7 @@
if (count == 0 && unsolicited)
finish();
}
-@@ -219,7 +226,7 @@ int recv_pack(unsigned char *buf, int le
+@@ -219,7 +232,7 @@ int recv_pack(unsigned char *buf, int le
return 0;
if (ah->ar_pln != 4)
return 0;
@@ -65,7 +58,7 @@
return 0;
if (len < sizeof(*ah) + 2*(4 + ah->ar_hln))
return 0;
-@@ -230,7 +237,7 @@ int recv_pack(unsigned char *buf, int le
+@@ -230,7 +243,7 @@ int recv_pack(unsigned char *buf, int le
return 0;
if (src.s_addr != dst_ip.s_addr)
return 0;
@@ -74,7 +67,7 @@
return 0;
} else {
/* DAD packet was:
-@@ -248,7 +255,7 @@ int recv_pack(unsigned char *buf, int le
+@@ -248,7 +261,7 @@ int recv_pack(unsigned char *buf, int le
*/
if (src_ip.s_addr != dst.s_addr)
return 0;
@@ -83,7 +76,7 @@
return 0;
if (src.s_addr && src.s_addr != dst_ip.s_addr)
return 0;
-@@ -264,7 +271,7 @@ int recv_pack(unsigned char *buf, int le
+@@ -264,7 +277,7 @@ int recv_pack(unsigned char *buf, int le
printf("for %s ", inet_ntoa(dst_ip));
s_printed = 1;
}
@@ -92,7 +85,7 @@
if (!s_printed)
printf("for ");
printf("[");
-@@ -290,7 +297,7 @@ int recv_pack(unsigned char *buf, int le
+@@ -290,12 +303,69 @@ int recv_pack(unsigned char *buf, int le
if (quit_on_reply)
finish();
if(!broadcast_only) {
@@ -101,7 +94,69 @@
unicasting=1;
}
return 1;
-@@ -459,9 +466,9 @@ main(int argc, char **argv)
+ }
+
++int get_sysfs_mnt_path(char *mnt_path, size_t len)
++{
++ const char *sysfs_path_env;
++ int pth_len=0;
++
++ if (len == 0 || mnt_path == NULL)
++ return -1;
++
++ /* possible overrride of real mount path */
++ sysfs_path_env = getenv(SYSFS_PATH_ENV);
++ memset(mnt_path, 0, len);
++ strncpy(mnt_path,
++ sysfs_path_env != NULL ? sysfs_path_env : SYSFS_MNT_PATH,
++ len-1);
++
++ if ((pth_len = strlen(mnt_path)) > 0 && mnt_path[pth_len-1] == '/')
++ mnt_path[pth_len-1] = '\0';
++
++ return 0;
++}
++
++int make_sysfs_broadcast_path(char *broadcast_path, size_t len)
++{
++ char mnt_path[SYSFS_PATH_LEN];
++
++ if (get_sysfs_mnt_path(mnt_path, len) != 0)
++ return -1;
++
++ snprintf(broadcast_path, len,
++ "%s/" SYSFS_CLASS "/" SYSFS_NET "/%s/" SYSFS_BROADCAST,
++ mnt_path, device);
++
++ return 0;
++}
++
++char * read_sysfs_broadcast(char *brdcast_path)
++{
++ int fd;
++ int len_to_read;
++ char *brdcast = NULL;
++
++ if ((fd = open(brdcast_path, O_RDONLY)) > -1) {
++ len_to_read = lseek(fd, 0L, SEEK_END);
++ if ((brdcast = malloc(len_to_read+1)) != NULL) {
++ lseek(fd, 0L, SEEK_SET);
++ memset(brdcast, 0, len_to_read+1);
++ if (read(fd, brdcast, len_to_read) == -1) {
++ free(brdcast);
++ brdcast = NULL;
++ }
++ }
++ close(fd);
++ }
++
++ return brdcast;
++}
++
+ int
+ main(int argc, char **argv)
+ {
+@@ -459,9 +529,9 @@ main(int argc, char **argv)
close(probe_fd);
};
@@ -114,7 +169,7 @@
if (bind(s, (struct sockaddr*)&me, sizeof(me)) == -1) {
perror("bind");
exit(2);
-@@ -474,14 +481,37 @@ main(int argc, char **argv)
+@@ -474,14 +544,33 @@ main(int argc, char **argv)
exit(2);
}
}
@@ -124,39 +179,34 @@
printf("Interface \"%s\" is not ARPable (no ll address)\n", device);
exit(dad?0:2);
}
--
-- he = me;
-- memset(he.sll_addr, -1, he.sll_halen);
+ he[0] = me[0];
+ he[1] = me[1];
+ {
-+ struct sysfs_class_device *dev;
-+ struct sysfs_attribute *brdcast;
-+ char *next_ch;
-+
-+ dev = sysfs_open_class_device("net", device);
-+ if (!dev) {
-+ perror("sysfs class device");
-+ exit(2);
-+ }
-+ brdcast = sysfs_get_classdev_attr(dev, "broadcast");
-+ if (!brdcast) {
-+ perror("sysfs attribute broadcast");
-+ exit(2);
-+ }
-+ if (sysfs_read_attribute(brdcast)) {
-+ perror("sysfs read brdcast");
-+ exit(2);
-+ }
-+ for (ch=0; ch<he[0].sll_halen; ch++) {
-+ he[0].sll_addr[ch] = strtol(brdcast->value + (ch*3),
-+ &next_ch, 16);
-+ }
++ char brdcast_path[SYSFS_PATH_LEN];
++ char *brdcast_val;
++ char *next_ch;
++
++ if (make_sysfs_broadcast_path(brdcast_path, sizeof brdcast_path) != 0) {
++ perror("sysfs attribute broadcast");
++ exit(2);
++ }
++
++ if ((brdcast_val = read_sysfs_broadcast(brdcast_path)) == NULL) {
++ perror("sysfs read broadcast value");
++ exit(2);
++ }
++ for (ch=0; ch<he[0].sll_halen; ch++) {
++ he[0].sll_addr[ch] = strtol(brdcast_val + (ch*3), &next_ch, 16);
++ }
+
+- he = me;
+- memset(he.sll_addr, -1, he.sll_halen);
++ free(brdcast_val);
+ }
if (!quiet) {
printf("ARPING %s ", inet_ntoa(dst));
-@@ -501,7 +531,7 @@ main(int argc, char **argv)
+@@ -501,12 +590,12 @@ main(int argc, char **argv)
while(1) {
sigset_t sset, osset;
unsigned char packet[4096];
@@ -165,7 +215,13 @@
socklen_t alen = sizeof(from);
int cc;
-@@ -514,7 +544,7 @@ main(int argc, char **argv)
+ if ((cc = recvfrom(s, packet, sizeof(packet), 0,
+- (struct sockaddr *)&from, &alen)) < 0) {
++ (struct sockaddr *)&from[0], &alen)) < 0) {
+ perror("arping: recvfrom");
+ continue;
+ }
+@@ -514,7 +603,7 @@ main(int argc, char **argv)
sigaddset(&sset, SIGALRM);
sigaddset(&sset, SIGINT);
sigprocmask(SIG_BLOCK, &sset, &osset);
@@ -174,3 +230,15 @@
sigprocmask(SIG_SETMASK, &osset, NULL);
}
}
+diff -up iputils-s20071127/Makefile.infiniband iputils-s20071127/Makefile
+--- iputils-s20071127/Makefile.infiniband 2008-08-08 09:17:35.000000000 +0200
++++ iputils-s20071127/Makefile 2008-08-08 10:02:10.000000000 +0200
+@@ -37,6 +37,8 @@ rdisc_srv: rdisc_srv.o
+ rdisc_srv.o: rdisc.c
+ $(CC) $(CFLAGS) -DRDISC_SERVER -o rdisc_srv.o rdisc.c
+
++arping: arping.o
++ $(CC) $(LDFLAGS) arping.o $(LOADLIBES) $(LDLIBS) -o arping
+
+ check-kernel:
+ ifeq ($(KERNEL_INCLUDE),)
Index: iputils.spec
===================================================================
RCS file: /cvs/extras/rpms/iputils/F-9/iputils.spec,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- iputils.spec 5 Aug 2008 13:40:38 -0000 1.60
+++ iputils.spec 5 Sep 2008 06:17:39 -0000 1.61
@@ -1,7 +1,7 @@
Summary: Network monitoring tools including ping
Name: iputils
Version: 20071127
-Release: 2%{?dist}
+Release: 3%{?dist}
License: BSD
URL: http://www.skbuff.net/iputils
Group: System Environment/Daemons
@@ -27,9 +27,9 @@
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: docbook-utils perl-SGMLSpm
BuildRequires: glibc-kernheaders >= 2.4-8.19
-BuildRequires: libsysfs-devel
BuildRequires: libidn-devel
Requires(post): /sbin/chkconfig
+Requires(post): /usr/sbin/setcap
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service
Requires(postun): /sbin/service
@@ -115,6 +115,9 @@
%post
/sbin/chkconfig --add rdisc
+/usr/sbin/setcap cap_net_raw=ep /bin/ping
+/usr/sbin/setcap cap_net_raw=ep /bin/ping6
+
%preun
if [ $1 = 0 ]; then
service rdisc stop >/dev/null 2>&1
@@ -140,15 +143,15 @@
%ifos linux
/sbin/arping
%{_sbindir}/arping
-%attr(4755,root,root) /bin/ping
+%attr(0755,root,root) /bin/ping
/sbin/ifenslave
%else
-%attr(4755,root,root) %{_sbindir}/ping
+%attr(0755,root,root) %{_sbindir}/ping
%{_sbindir}/arping
%{_sbindir}/ifenslave
%endif
/sbin/rdisc
-%attr(4755,root,root) /bin/ping6
+%attr(0755,root,root) /bin/ping6
/bin/tracepath
/bin/tracepath6
%{_sbindir}/ping6
@@ -158,6 +161,11 @@
%{_sysconfdir}/rc.d/init.d/rdisc
%changelog
+* Thu Sep 04 2008 Jiri Skala <jskala at redhat.com> - 20071127-3
+- removed a dependency on libsysfs library in arping
+- Resolves: #455713 remove suid from ping
+- corrected typing error in man
+
* Tue Mar 25 2008 Martin Nagy <mnagy at redhat.com> - 20071127-2
- fix inconsistent behaviour of ping (#360881)
More information about the fedora-extras-commits
mailing list