iputils: merge fedora patches, ping{,6} doesn't need to be suid anymore.

This commit is contained in:
Juan RP 2012-01-23 13:27:39 +01:00
parent 5d0794c27d
commit 68335665c6
22 changed files with 1142 additions and 31 deletions

13
srcpkgs/iputils/INSTALL Normal file
View File

@ -0,0 +1,13 @@
case ${ACTION} in
post)
# Set required capability to ping{,6}.
for f in ping ping6; do
set +e
setcap cap_net_raw=ep sbin/${f}
if [ $? -ne 0 ]; then
echo "Failed to set cap_net_raw capability on sbin/${f}."
exit 0
fi
done
;;
esac

View File

@ -1,4 +1,5 @@
libc.so.6 libc.so.6
libresolv.so.2 libresolv.so.2
libcrypto.so.1 libcrypto.so.1
libsysfs.so.2 libidn.so.11
libcap.so.2

View File

@ -1,18 +0,0 @@
--- a/Makefile.orig 2010-10-06 13:59:20.000000000 +0200
+++ b/Makefile 2011-02-01 01:58:43.338899085 +0100
@@ -25,6 +25,15 @@ TAG:=`date +s%Y%m%d`
all: $(TARGETS)
+install:
+ for f in $(TARGETS); do \
+ if [ "$$f" = "ping" -o "$$f" = "ping6" ]; then \
+ install -D -m4755 $$f $(DESTDIR)/sbin/$$f; \
+ else \
+ install -D -m755 $$f $(DESTDIR)/sbin/$$f; \
+ fi; \
+ \
+ done
tftpd: tftpd.o tftpsubs.o
arping: arping.o -lsysfs

View File

@ -0,0 +1,12 @@
--- iputils/ping_common.c.countermeasures Tue May 21 10:06:05 2002
+++ iputils/ping_common.c Tue May 21 10:12:42 2002
@@ -628,7 +628,8 @@
tvsub(tv, &tmp_tv);
triptime = tv->tv_sec * 1000000 + tv->tv_usec;
if (triptime < 0) {
- fprintf(stderr, "Warning: time of day goes back (%ldus), taking countermeasures.\n", triptime);
+ if (options & F_VERBOSE)
+ fprintf(stderr, "Warning: time of day goes back (%ldus), taking countermeasures.\n", triptime);
triptime = 0;
if (!(options & F_LATENCY)) {
gettimeofday(tv, NULL);

View File

@ -0,0 +1,31 @@
--- iputils/ping.c.addrcache 2002-09-20 17:08:11.000000000 +0200
+++ iputils/ping.c 2003-05-15 16:41:19.000000000 +0200
@@ -1124,6 +1124,12 @@
{
struct hostent *hp;
static char buf[4096];
+ static __u32 addr_cache = 0;
+
+ if ( addr == addr_cache )
+ return buf;
+
+ addr_cache = addr;
if ((options & F_NUMERIC) ||
!(hp = gethostbyaddr((char *)&addr, 4, AF_INET)))
--- iputils/ping6.c.addrcache 2002-09-20 17:08:11.000000000 +0200
+++ iputils/ping6.c 2003-05-15 16:41:19.000000000 +0200
@@ -893,7 +893,12 @@
*/
char * pr_addr(struct in6_addr *addr)
{
- struct hostent *hp = NULL;
+ static struct hostent *hp;
+ static struct in6_addr addr_cache;
+
+ if (memcmp(addr, &addr_cache, sizeof(addr_cache)) == 0)
+ return hp ? hp->h_name : pr_addr_n(addr);
+ memcpy(&addr_cache, addr, sizeof(addr_cache));
if (!(options&F_NUMERIC))
hp = gethostbyaddr((__u8*)addr, sizeof(struct in6_addr), AF_INET6);

View File

@ -0,0 +1,12 @@
--- iputils-ss021109-vanilla/ping.c Thu Nov 7 23:53:21 2002
+++ iputils/ping.c Sun Jan 12 03:39:24 2003
@@ -285,6 +285,9 @@
perror("ping: IP_MULTICAST_IF");
exit(2);
}
+ } else if (icmp_sock >= 0) {
+ /* We possible tried to SO_BINDTODEVICE() a subinterface like 'eth0:1' */
+ perror("Warning: cannot bind to specified iface, falling back");
}
}
}

View File

@ -0,0 +1,15 @@
--- iputils/Makefile.rh7 2002-09-20 20:23:55.000000000 +0200
+++ iputils/Makefile 2004-05-12 15:08:25.638310270 +0200
@@ -12,9 +12,9 @@ ADDLIB=
CC=gcc
# What a pity, all new gccs are buggy and -Werror does not work. Sigh.
-#CCOPT=-D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -g -Werror
-CCOPT=-D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -g
-CFLAGS=$(CCOPT) $(GLIBCFIX) $(DEFINES)
+CCOPT=-Wstrict-prototypes -fno-strict-aliasing -Werror
+DEFINES += -D_GNU_SOURCE
+CFLAGS += $(RPM_OPT_FLAGS) $(CCOPT) $(GLIBCFIX) $(DEFINES)
IPV4_TARGETS=tracepath ping clockdiff rdisc arping tftpd rarpd
IPV6_TARGETS=tracepath6 traceroute6 ping6

View File

@ -0,0 +1,43 @@
diff -up iputils-s20071127/ping.c.ia64_align iputils-s20071127/ping.c
--- iputils-s20071127/ping.c.ia64_align 2008-06-02 08:56:32.000000000 +0200
+++ iputils-s20071127/ping.c 2008-06-02 08:56:32.000000000 +0200
@@ -200,13 +200,13 @@ main(int argc, char **argv)
ptr[3] = i4;
options |= F_STRICTSOURCE;
} else {
- device = optarg;
+ device = strdup(optarg);
}
#else
if (inet_pton(AF_INET, optarg, &source.sin_addr) > 0)
options |= F_STRICTSOURCE;
else
- device = optarg;
+ device = strdup(optarg);
#endif
break;
}
diff -up iputils-s20071127/arping.c.ia64_align iputils-s20071127/arping.c
--- iputils-s20071127/arping.c.ia64_align 2008-06-02 08:56:32.000000000 +0200
+++ iputils-s20071127/arping.c 2008-06-02 08:56:32.000000000 +0200
@@ -351,7 +351,7 @@ main(int argc, char **argv)
timeout = atoi(optarg);
break;
case 'I':
- device = optarg;
+ device = strdup(optarg);
break;
case 'f':
quit_on_reply=1;
diff -up iputils-s20071127/ping6.c.ia64_align iputils-s20071127/ping6.c
--- iputils-s20071127/ping6.c.ia64_align 2008-06-02 08:56:32.000000000 +0200
+++ iputils-s20071127/ping6.c 2008-06-02 08:56:32.000000000 +0200
@@ -581,7 +581,7 @@ int main(int argc, char *argv[])
free(addr);
} else {
- device = optarg;
+ device = strdup(optarg);
}
break;
case 'M':

View File

@ -0,0 +1,98 @@
diff -up iputils-s20100418/Makefile.idn iputils-s20100418/Makefile
--- iputils-s20100418/Makefile.idn 2010-04-20 16:07:59.018479157 +0200
+++ iputils-s20100418/Makefile 2010-04-20 16:10:06.389481427 +0200
@@ -28,8 +28,13 @@ all: $(TARGETS)
tftpd: tftpd.o tftpsubs.o
-arping: arping.o -lsysfs
+arping: arping.o
+
ping: ping.o ping_common.o
-ping6: ping6.o ping_common.o -lresolv -lcrypto
+ $(CC) $(CFLAGS) $(LDFLAGS) ping.o ping_common.o -lidn -o ping
+
+ping6: ping6.o ping_common.o
+ $(CC) $(CFLAGS) $(LDFLAGS) ping6.o ping_common.o -lresolv -lcrypto -o ping6
+
ping.o ping6.o ping_common.o: ping_common.h
tftpd.o tftpsubs.o: tftp.h
diff -up iputils-s20100418/ping.c.idn iputils-s20100418/ping.c
--- iputils-s20100418/ping.c.idn 2010-04-20 16:07:59.038484302 +0200
+++ iputils-s20100418/ping.c 2010-04-20 16:07:59.077485007 +0200
@@ -58,6 +58,9 @@ char copyright[] =
* This program has to run SUID to ROOT to access the ICMP socket.
*/
+#include <idna.h>
+#include <locale.h>
+
#include "ping_common.h"
#include <netinet/ip.h>
@@ -123,6 +126,10 @@ main(int argc, char **argv)
char *target, hnamebuf[MAX_HOSTNAMELEN];
char rspace[3 + 4 * NROUTES + 1]; /* record route space */
+ char *idn;
+ int rc = 0;
+ setlocale(LC_ALL, "");
+
icmp_sock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
socket_errno = errno;
@@ -250,13 +257,27 @@ main(int argc, char **argv)
if (argc == 1)
options |= F_NUMERIC;
} else {
- hp = gethostbyname(target);
+ rc = idna_to_ascii_lz (target, &idn, 0);
+ if (rc == IDNA_SUCCESS)
+ hp = gethostbyname (idn);
+ else {
+ fprintf(stderr, "ping: IDN encoding of '%s' failed with error code %d\n", target, rc);
+ exit(2);
+ }
+ free(idn);
if (!hp) {
fprintf(stderr, "ping: unknown host %s\n", target);
exit(2);
}
memcpy(&whereto.sin_addr, hp->h_addr, 4);
- strncpy(hnamebuf, hp->h_name, sizeof(hnamebuf) - 1);
+ rc = idna_to_unicode_lzlz (hp->h_name, &idn, 0);
+ if (rc == IDNA_SUCCESS)
+ strncpy(hnamebuf, idn, sizeof(hnamebuf) - 1);
+ else {
+ fprintf(stderr, "ping: IDN encoding of '%s' failed with error code %d\n", hp->h_name, rc);
+ exit(2);
+ }
+ free(idn);
hnamebuf[sizeof(hnamebuf) - 1] = 0;
hostname = hnamebuf;
}
diff -up iputils-s20100418/ping_common.c.idn iputils-s20100418/ping_common.c
--- iputils-s20100418/ping_common.c.idn 2010-04-20 16:07:59.039478452 +0200
+++ iputils-s20100418/ping_common.c 2010-04-20 16:07:59.069478660 +0200
@@ -1,3 +1,5 @@
+#include <locale.h>
+
#include "ping_common.h"
#include <ctype.h>
#include <sched.h>
@@ -98,6 +100,7 @@ static void fill(char *patp)
void common_options(int ch)
{
+ setlocale(LC_ALL, "C");
switch(ch) {
case 'a':
options |= F_AUDIBLE;
@@ -242,6 +245,7 @@ void common_options(int ch)
default:
abort();
}
+ setlocale(LC_ALL, "");
}

View File

@ -0,0 +1,14 @@
diff -up iputils-s20070202/ping6.c.flowlabel iputils-s20070202/ping6.c
--- iputils-s20070202/ping6.c.flowlabel 2008-02-01 11:10:53.000000000 +0100
+++ iputils-s20070202/ping6.c 2008-02-01 11:16:47.000000000 +0100
@@ -86,6 +86,10 @@ char copyright[] =
#define SOL_ICMPV6 IPPROTO_ICMPV6
#endif
+#ifndef IVP6_FLOWINFO_SEND
+#define IPV6_FLOWINFO_SEND 33
+#endif
+
/* RFC3542 */
#ifndef ICMP6_DST_UNREACH_BEYONDSCOPE
#define ICMP6_DST_UNREACH_BEYONDSCOPE ICMP6_DST_UNREACH_NOTNEIGHBOR

View File

@ -0,0 +1,88 @@
diff -up iputils-s20100418/ping6.c.corr_type iputils-s20100418/ping6.c
--- iputils-s20100418/ping6.c.corr_type 2010-04-20 15:42:39.181245576 +0200
+++ iputils-s20100418/ping6.c 2010-04-20 15:42:39.198230879 +0200
@@ -1335,7 +1335,7 @@ parse_reply(struct msghdr *msg, int cc,
#endif
if (c->cmsg_len < CMSG_LEN(sizeof(int)))
continue;
- hops = *(int*)CMSG_DATA(c);
+ memcpy(&hops, CMSG_DATA(c), sizeof (int));
}
}
diff -up iputils-s20100418/ping.c.corr_type iputils-s20100418/ping.c
--- iputils-s20100418/ping.c.corr_type 2010-04-20 15:42:39.193242030 +0200
+++ iputils-s20100418/ping.c 2010-04-20 15:42:39.199231317 +0200
@@ -1211,18 +1211,20 @@ pr_addr(__u32 addr)
struct hostent *hp;
static char buf[4096];
static __u32 addr_cache = 0;
+ struct in_addr tmp_addr;
if ( addr == addr_cache )
return buf;
addr_cache = addr;
+ tmp_addr.s_addr = addr;
if ((options & F_NUMERIC) ||
!(hp = gethostbyaddr((char *)&addr, 4, AF_INET)))
- sprintf(buf, "%s", inet_ntoa(*(struct in_addr *)&addr));
+ sprintf(buf, "%s", inet_ntoa(tmp_addr));
else
snprintf(buf, sizeof(buf), "%s (%s)", hp->h_name,
- inet_ntoa(*(struct in_addr *)&addr));
+ inet_ntoa(tmp_addr));
return(buf);
}
diff -up iputils-s20100418/rdisc.c.corr_type iputils-s20100418/rdisc.c
--- iputils-s20100418/rdisc.c.corr_type 2010-04-18 06:45:45.000000000 +0200
+++ iputils-s20100418/rdisc.c 2010-04-20 15:42:39.201230377 +0200
@@ -1487,14 +1487,19 @@ rtioctl(struct in_addr addr, int op)
{
int sock;
struct rtentry rt;
- struct sockaddr_in *sin;
+ union {
+ struct sockaddr *sa;
+ struct sockaddr_in *sin;
+ } conv;
memset((char *)&rt, 0, sizeof(struct rtentry));
rt.rt_dst.sa_family = AF_INET;
rt.rt_gateway.sa_family = AF_INET;
rt.rt_genmask.sa_family = AF_INET;
- sin = (struct sockaddr_in *)ALLIGN(&rt.rt_gateway);
- sin->sin_addr = addr;
+ // gcc4.4 hack
+ conv.sa = ALLIGN(&rt.rt_gateway);
+ memcpy(&conv.sin->sin_addr, &addr, sizeof(struct in_addr));
+ // -----------
rt.rt_flags = RTF_UP | RTF_GATEWAY;
sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
diff -up iputils-s20100418/tracepath6.c.corr_type iputils-s20100418/tracepath6.c
--- iputils-s20100418/tracepath6.c.corr_type 2010-04-18 06:45:45.000000000 +0200
+++ iputils-s20100418/tracepath6.c 2010-04-20 15:44:15.129480911 +0200
@@ -173,7 +173,7 @@ restart:
#ifdef IPV6_2292HOPLIMIT
case IPV6_2292HOPLIMIT:
#endif
- rethops = *(int*)CMSG_DATA(cmsg);
+ memcpy(&rethops, CMSG_DATA(cmsg), sizeof (int));
break;
default:
printf("cmsg6:%d\n ", cmsg->cmsg_type);
diff -up iputils-s20100418/tracepath.c.corr_type iputils-s20100418/tracepath.c
--- iputils-s20100418/tracepath.c.corr_type 2010-04-18 06:45:45.000000000 +0200
+++ iputils-s20100418/tracepath.c 2010-04-20 15:42:39.203240403 +0200
@@ -145,7 +145,7 @@ restart:
if (cmsg->cmsg_type == IP_RECVERR) {
e = (struct sock_extended_err *) CMSG_DATA(cmsg);
} else if (cmsg->cmsg_type == IP_TTL) {
- rethops = *(int*)CMSG_DATA(cmsg);
+ memcpy(&rethops, CMSG_DATA(cmsg), sizeof(int));
} else {
printf("cmsg:%d\n ", cmsg->cmsg_type);
}

View File

@ -0,0 +1,266 @@
diff -up iputils-s20101006/arping.c.infiniband iputils-s20101006/arping.c
--- iputils-s20101006/arping.c.infiniband 2010-10-11 09:17:57.440390823 +0200
+++ iputils-s20101006/arping.c 2010-10-11 09:23:36.147402252 +0200
@@ -32,8 +32,6 @@
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <sysfs/libsysfs.h>
-
#include "SNAPSHOT.h"
static void usage(void) __attribute__((noreturn));
@@ -52,14 +50,22 @@ int unicasting;
int s;
int broadcast_only;
-struct sockaddr_storage me;
-struct sockaddr_storage he;
+struct sockaddr_ll *me=NULL;
+struct sockaddr_ll *he=NULL;
struct timeval start, last;
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 SOCKADDR_LEN (2 * sizeof(struct sockaddr_ll))
+
#define MS_TDIFF(tv1,tv2) ( ((tv1).tv_sec-(tv2).tv_sec)*1000 + \
((tv1).tv_usec-(tv2).tv_usec)/1000 )
@@ -166,6 +172,10 @@ void finish(void)
printf("\n");
fflush(stdout);
}
+
+ free(me);
+ free(he);
+
if (dad)
exit(!!received);
if (unsolicited)
@@ -186,8 +196,7 @@ void catcher(void)
finish();
if (last.tv_sec==0 || MS_TDIFF(tv,last) > 500) {
- send_pack(s, src, dst,
- (struct sockaddr_ll *)&me, (struct sockaddr_ll *)&he);
+ send_pack(s, src, dst, me, he);
if (count == 0 && unsolicited)
finish();
}
@@ -234,7 +243,7 @@ int recv_pack(unsigned char *buf, int le
return 0;
if (ah->ar_pln != 4)
return 0;
- if (ah->ar_hln != ((struct sockaddr_ll *)&me)->sll_halen)
+ if (ah->ar_hln != me->sll_halen)
return 0;
if (len < sizeof(*ah) + 2*(4 + ah->ar_hln))
return 0;
@@ -245,7 +254,7 @@ int recv_pack(unsigned char *buf, int le
return 0;
if (src.s_addr != dst_ip.s_addr)
return 0;
- if (memcmp(p+ah->ar_hln+4, ((struct sockaddr_ll *)&me)->sll_addr, ah->ar_hln))
+ if (memcmp(p+ah->ar_hln+4, me->sll_addr, ah->ar_hln))
return 0;
} else {
/* DAD packet was:
@@ -263,7 +272,7 @@ int recv_pack(unsigned char *buf, int le
*/
if (src_ip.s_addr != dst.s_addr)
return 0;
- if (memcmp(p, ((struct sockaddr_ll *)&me)->sll_addr, ((struct sockaddr_ll *)&me)->sll_halen) == 0)
+ if (memcmp(p, me->sll_addr, me->sll_halen) == 0)
return 0;
if (src.s_addr && src.s_addr != dst_ip.s_addr)
return 0;
@@ -279,7 +288,7 @@ int recv_pack(unsigned char *buf, int le
printf("for %s ", inet_ntoa(dst_ip));
s_printed = 1;
}
- if (memcmp(p+ah->ar_hln+4, ((struct sockaddr_ll *)&me)->sll_addr, ah->ar_hln)) {
+ if (memcmp(p+ah->ar_hln+4, me->sll_addr, ah->ar_hln)) {
if (!s_printed)
printf("for ");
printf("[");
@@ -305,40 +314,67 @@ int recv_pack(unsigned char *buf, int le
if (quit_on_reply)
finish();
if(!broadcast_only) {
- memcpy(((struct sockaddr_ll *)&he)->sll_addr, p, ((struct sockaddr_ll *)&me)->sll_halen);
+ memcpy(he->sll_addr, p, me->sll_halen);
unicasting=1;
}
return 1;
}
-void set_device_broadcast(char *device, unsigned char *ba, size_t balen)
+int get_sysfs_mnt_path(char *mnt_path, size_t len)
{
- struct sysfs_class_device *dev;
- struct sysfs_attribute *brdcast;
- unsigned char *p;
- int ch;
+ const char *sysfs_path_env;
+ int pth_len=0;
- dev = sysfs_open_class_device("net", device);
- if (!dev) {
- perror("sysfs_open_class_device(net)");
- exit(2);
- }
+ if (len == 0 || mnt_path == NULL)
+ return -1;
- brdcast = sysfs_get_classdev_attr(dev, "broadcast");
- if (!brdcast) {
- perror("sysfs_get_classdev_attr(broadcast)");
- exit(2);
- }
+ /* 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 (sysfs_read_attribute(brdcast)) {
- perror("sysfs_read_attribute");
- exit(2);
- }
+ 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;
- for (p = ba, ch = 0; p < ba + balen; p++, ch += 3)
- *p = strtoul(brdcast->value + ch, NULL, 16);
+ snprintf(broadcast_path, len,
+ "%s/" SYSFS_CLASS "/" SYSFS_NET "/%s/" SYSFS_BROADCAST,
+ mnt_path, device);
- return;
+ 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
@@ -356,6 +392,17 @@ main(int argc, char **argv)
exit(-1);
}
+ me = malloc(SOCKADDR_LEN);
+ if (!me) {
+ fprintf(stderr, "arping: could not allocate memory\n");
+ exit(1);
+ }
+ he = malloc(SOCKADDR_LEN);
+ if (!he) {
+ fprintf(stderr, "arping: could not allocate memory\n");
+ exit(1);
+ }
+
while ((ch = getopt(argc, argv, "h?bfDUAqc:w:s:I:V")) != EOF) {
switch(ch) {
case 'b':
@@ -504,34 +551,51 @@ main(int argc, char **argv)
close(probe_fd);
};
- ((struct sockaddr_ll *)&me)->sll_family = AF_PACKET;
- ((struct sockaddr_ll *)&me)->sll_ifindex = ifindex;
- ((struct sockaddr_ll *)&me)->sll_protocol = htons(ETH_P_ARP);
- if (bind(s, (struct sockaddr*)&me, sizeof(me)) == -1) {
+ me->sll_family = AF_PACKET;
+ me->sll_ifindex = ifindex;
+ me->sll_protocol = htons(ETH_P_ARP);
+ if (bind(s, (struct sockaddr*)me, SOCKADDR_LEN) == -1) {
perror("bind");
exit(2);
}
if (1) {
- socklen_t alen = sizeof(me);
- if (getsockname(s, (struct sockaddr*)&me, &alen) == -1) {
+ socklen_t alen = SOCKADDR_LEN;
+ if (getsockname(s, (struct sockaddr*)me, &alen) == -1) {
perror("getsockname");
exit(2);
}
}
- if (((struct sockaddr_ll *)&me)->sll_halen == 0) {
+ if (me->sll_halen == 0) {
if (!quiet)
printf("Interface \"%s\" is not ARPable (no ll address)\n", device);
exit(dad?0:2);
}
- he = me;
+ memcpy(he, me, SOCKADDR_LEN);
#if 1
- set_device_broadcast(device, ((struct sockaddr_ll *)&he)->sll_addr,
- ((struct sockaddr_ll *)&he)->sll_halen);
+ char brdcast_path[SYSFS_PATH_LEN];
+ char *brdcast_val=NULL;
+ 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->sll_halen; ch++) {
+ he->sll_addr[ch] = strtol(brdcast_val + (ch*3), &next_ch, 16);
+ }
+
+ free(brdcast_val);
#else
- memset(((struct sockaddr_ll *)&he)->sll_addr, -1, ((struct sockaddr_ll *)&he)->sll_halen);
+ memset(he->sll_addr, -1, he->sll_halen);
#endif
if (!quiet) {

View File

@ -0,0 +1,126 @@
diff -up iputils-s20071127/ping_common.c.warnings iputils-s20071127/ping_common.c
--- iputils-s20071127/ping_common.c.warnings 2008-06-02 13:29:27.000000000 +0200
+++ iputils-s20071127/ping_common.c 2008-06-02 13:29:27.000000000 +0200
@@ -338,7 +338,7 @@ resend:
* high preload or pipe size is very confusing. */
if ((preload < screen_width && pipesize < screen_width) ||
in_flight() < screen_width)
- write(STDOUT_FILENO, ".", 1);
+ printf(".");
}
return interval - tokens;
}
@@ -391,7 +391,7 @@ resend:
if (i == 0 && !(options & F_QUIET)) {
if (options & F_FLOOD)
- write(STDOUT_FILENO, "E", 1);
+ printf("E");
else
perror("ping: sendmsg");
}
@@ -717,9 +717,9 @@ restamp:
if (options & F_FLOOD) {
if (!csfailed)
- write(STDOUT_FILENO, "\b \b", 3);
+ printf("\b \b");
else
- write(STDOUT_FILENO, "\bC", 1);
+ printf("\bC");
} else {
int i;
__u8 *cp, *dp;
diff -up iputils-s20071127/clockdiff.c.warnings iputils-s20071127/clockdiff.c
--- iputils-s20071127/clockdiff.c.warnings 2007-11-27 01:57:27.000000000 +0100
+++ iputils-s20071127/clockdiff.c 2008-06-02 13:29:27.000000000 +0200
@@ -628,8 +628,6 @@ main(int argc, char *argv[])
}
}
- nice(-16);
-
if ((measure_status = (ip_opt_len ? measure_opt : measure)(&server)) < 0) {
if (errno)
perror("measure");
diff -up iputils-s20071127/ping6.c.warnings iputils-s20071127/ping6.c
--- iputils-s20071127/ping6.c.warnings 2008-06-02 13:30:06.000000000 +0200
+++ iputils-s20071127/ping6.c 2008-06-02 13:31:14.000000000 +0200
@@ -1037,7 +1037,7 @@ int receive_error_msg()
if (options & F_QUIET)
goto out;
if (options & F_FLOOD)
- write(STDOUT_FILENO, "E", 1);
+ printf("E");
else if (e->ee_errno != EMSGSIZE)
fprintf(stderr, "ping: local error: %s\n", strerror(e->ee_errno));
else
@@ -1060,7 +1060,7 @@ int receive_error_msg()
if (options & F_QUIET)
goto out;
if (options & F_FLOOD) {
- write(STDOUT_FILENO, "\bE", 2);
+ printf("\bE");
} else {
print_timestamp();
printf("From %s icmp_seq=%u ", pr_addr(&sin6->sin6_addr), ntohs(icmph.icmp6_seq));
@@ -1400,7 +1400,7 @@ parse_reply(struct msghdr *msg, int cc,
return 0;
nerrors++;
if (options & F_FLOOD) {
- write(STDOUT_FILENO, "\bE", 2);
+ printf("\bE");
return 0;
}
print_timestamp();
diff -up iputils-s20071127/ping.c.warnings iputils-s20071127/ping.c
--- iputils-s20071127/ping.c.warnings 2008-06-02 13:29:27.000000000 +0200
+++ iputils-s20071127/ping.c 2008-06-02 13:29:27.000000000 +0200
@@ -367,7 +367,7 @@ main(int argc, char **argv)
}
source.sin_port = 0;
close(probe_fd);
- } while (0);
+ }
if (whereto.sin_addr.s_addr == 0)
whereto.sin_addr.s_addr = source.sin_addr.s_addr;
@@ -594,7 +594,7 @@ int receive_error_msg()
if (options & F_QUIET)
goto out;
if (options & F_FLOOD)
- write(STDOUT_FILENO, "E", 1);
+ printf("E");
else if (e->ee_errno != EMSGSIZE)
fprintf(stderr, "ping: local error: %s\n", strerror(e->ee_errno));
else
@@ -630,7 +630,7 @@ int receive_error_msg()
if (options & F_QUIET)
goto out;
if (options & F_FLOOD) {
- write(STDOUT_FILENO, "\bE", 2);
+ printf("\bE");
} else {
print_timestamp();
printf("From %s icmp_seq=%u ", pr_addr(sin->sin_addr.s_addr), ntohs(icmph.un.echo.sequence));
@@ -795,7 +795,7 @@ parse_reply(struct msghdr *msg, int cc,
return !error_pkt;
if (options & F_FLOOD) {
if (error_pkt)
- write(STDOUT_FILENO, "\bE", 2);
+ printf("\bE");
return !error_pkt;
}
print_timestamp();
@@ -812,9 +812,9 @@ parse_reply(struct msghdr *msg, int cc,
}
if ((options & F_FLOOD) && !(options & (F_VERBOSE|F_QUIET))) {
if (!csfailed)
- write(STDOUT_FILENO, "!E", 2);
+ printf("!E");
else
- write(STDOUT_FILENO, "!EC", 3);
+ printf("!EC");
return 0;
}
if (!(options & F_VERBOSE) || uid)

View File

@ -0,0 +1,24 @@
diff -up iputils-s20100418/tracepath6.c.convtoint iputils-s20100418/tracepath6.c
--- iputils-s20100418/tracepath6.c.convtoint 2010-04-23 11:28:15.294593391 +0200
+++ iputils-s20100418/tracepath6.c 2010-04-23 11:28:23.544605551 +0200
@@ -89,7 +89,7 @@ void print_host(const char *a, const cha
}
if (plen >= HOST_COLUMN_SIZE)
plen = HOST_COLUMN_SIZE - 1;
- printf("%*s", HOST_COLUMN_SIZE - plen, "");
+ printf("%*s", HOST_COLUMN_SIZE - (int)plen, "");
}
int recverr(int fd, int ttl)
diff -up iputils-s20100418/tracepath.c.convtoint iputils-s20100418/tracepath.c
--- iputils-s20100418/tracepath.c.convtoint 2010-04-23 11:26:20.273555629 +0200
+++ iputils-s20100418/tracepath.c 2010-04-23 11:26:20.281562493 +0200
@@ -77,7 +77,7 @@ void print_host(const char *a, const cha
}
if (plen >= HOST_COLUMN_SIZE)
plen = HOST_COLUMN_SIZE - 1;
- printf("%*s", HOST_COLUMN_SIZE - plen, "");
+ printf("%*s", HOST_COLUMN_SIZE - (int)plen, "");
}
int recverr(int fd, int ttl)

View File

@ -0,0 +1,107 @@
diff -up iputils-s20101006/Makefile.drop_caps iputils-s20101006/Makefile
--- iputils-s20101006/Makefile 2010-11-08 14:49:53.334577997 +0100
+++ iputils-s20101006/Makefile 2010-11-08 14:49:53.342599113 +0100
@@ -13,7 +13,7 @@ ADDLIB=
CC=gcc
# What a pity, all new gccs are buggy and -Werror does not work. Sigh.
CCOPT=-Wstrict-prototypes -fno-strict-aliasing -Werror
-DEFINES += -D_GNU_SOURCE
+DEFINES += -D_GNU_SOURCE -DHAVE_CAPABILITIES
CFLAGS += $(RPM_OPT_FLAGS) $(CCOPT) $(GLIBCFIX) $(DEFINES)
IPV4_TARGETS=tracepath ping clockdiff rdisc arping tftpd rarpd
@@ -30,10 +30,10 @@ tftpd: tftpd.o tftpsubs.o
arping: arping.o
ping: ping.o ping_common.o
- $(CC) $(CFLAGS) $(LDFLAGS) ping.o ping_common.o -lidn -o ping
+ $(CC) $(CFLAGS) $(LDFLAGS) ping.o ping_common.o -lidn -lcap -o ping
ping6: ping6.o ping_common.o
- $(CC) $(CFLAGS) $(LDFLAGS) ping6.o ping_common.o -lresolv -lcrypto -o ping6
+ $(CC) $(CFLAGS) $(LDFLAGS) ping6.o ping_common.o -lresolv -lcrypto -lcap -o ping6
ping.o ping6.o ping_common.o: ping_common.h in6_flowlabel.h
tftpd.o tftpsubs.o: tftp.h
diff -up iputils-s20101006/ping6.c.drop_caps iputils-s20101006/ping6.c
--- iputils-s20101006/ping6.c.drop_caps 2010-11-08 14:49:53.338587611 +0100
+++ iputils-s20101006/ping6.c 2010-12-15 16:06:16.949794002 +0100
@@ -73,6 +73,10 @@ char copyright[] =
#include <netinet/icmp6.h>
#include <resolv.h>
+#ifdef HAVE_CAPABILITIES
+#include <sys/capability.h>
+#endif
+
#include "ping6_niquery.h"
#include "in6_flowlabel.h"
@@ -533,6 +537,9 @@ int main(int argc, char *argv[])
int csum_offset, sz_opt;
#endif
static uint32_t scope_id = 0;
+#ifdef HAVE_CAPABILITIES
+ cap_t caps;
+#endif
icmp_sock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
socket_errno = errno;
@@ -543,6 +550,16 @@ int main(int argc, char *argv[])
exit(-1);
}
+#ifdef HAVE_CAPABILITIES
+ /* drop all capabilities unconditionally so even root isn't special anymore */
+ caps = cap_init();
+ if (cap_set_proc(caps) < 0) {
+ perror("ping: cap_set_proc");
+ exit(-1);
+ }
+ cap_free(caps);
+#endif
+
source.sin6_family = AF_INET6;
memset(&firsthop, 0, sizeof(firsthop));
firsthop.sin6_family = AF_INET6;
diff -up iputils-s20101006/ping.c.drop_caps iputils-s20101006/ping.c
--- iputils-s20101006/ping.c.drop_caps 2010-11-08 14:49:53.314577272 +0100
+++ iputils-s20101006/ping.c 2010-12-15 16:05:52.113794002 +0100
@@ -66,6 +66,10 @@ char copyright[] =
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
+#ifdef HAVE_CAPABILITIES
+#include <sys/capability.h>
+#endif
+
#ifndef ICMP_FILTER
#define ICMP_FILTER 1
struct icmp_filter {
@@ -125,6 +129,9 @@ main(int argc, char **argv)
u_char *packet;
char *target, hnamebuf[MAX_HOSTNAMELEN];
char rspace[3 + 4 * NROUTES + 1]; /* record route space */
+#ifdef HAVE_CAPABILITIES
+ cap_t caps;
+#endif
char *idn;
int rc = 0;
@@ -139,6 +146,16 @@ main(int argc, char **argv)
exit(-1);
}
+#ifdef HAVE_CAPABILITIES
+ /* drop all capabilities unconditionally so even root isn't special anymore */
+ caps = cap_init();
+ if (cap_set_proc(caps) < 0) {
+ perror("ping: cap_set_proc");
+ exit(-1);
+ }
+ cap_free(caps);
+#endif
+
source.sin_family = AF_INET;
preload = 1;

View File

@ -0,0 +1,91 @@
diff -up iputils-s20101006/arping.c.eth iputils-s20101006/arping.c
--- iputils-s20101006/arping.c.eth 2011-11-10 09:06:08.101748109 +0100
+++ iputils-s20101006/arping.c 2011-11-10 09:34:09.880501394 +0100
@@ -37,7 +37,7 @@
static void usage(void) __attribute__((noreturn));
int quit_on_reply=0;
-char *device="eth0";
+char *device=NULL;
int ifindex;
char *source;
struct in_addr src, dst;
@@ -66,6 +66,11 @@ int received, brd_recv, req_recv;
#define SYSFS_PATH_LEN 256
#define SOCKADDR_LEN (2 * sizeof(struct sockaddr_ll))
+#define PREF_ETH "eth"
+#define PREF_EM "em"
+
+static char *dev_file = "/proc/self/net/dev";
+
#define MS_TDIFF(tv1,tv2) ( ((tv1).tv_sec-(tv2).tv_sec)*1000 + \
((tv1).tv_usec-(tv2).tv_usec)/1000 )
@@ -377,6 +382,46 @@ char * read_sysfs_broadcast(char *brdcas
return brdcast;
}
+/*
+ * get_first_ethernet - return the name of the first ethernet-style
+ * interface on this system.
+ */
+char * get_first_ethernet(void)
+{
+ FILE *f;
+ char buf[255], *dv, *smc;
+ char pci[16];
+
+ memset(pci, 0, sizeof(pci));
+ if ((f = fopen(dev_file, "r")) != NULL)
+ {
+ // go through network dev file
+ while (fgets (buf, sizeof(buf), f) != NULL)
+ {
+ // the line describes interface
+ if ((smc = strchr(buf, ':')) != NULL)
+ {
+ // trim white characters
+ for (dv=buf, *smc=0; *dv <= ' '; dv++) ;
+ // is "eth" (originial ethernet name) or "em" (ethernet on board)
+ if (!strncmp(dv, PREF_ETH, strlen(PREF_ETH)) ||
+ !strncmp(dv, PREF_EM, strlen(PREF_EM)))
+ {
+ return strdup(dv);
+ }
+ // remember the first pci NIC-card
+ if (strlen(pci) == 0 && dv[0] == 'p' && isdigit(dv[1]))
+ {
+ strcpy(pci, dv);
+ }
+ }
+ }
+ fclose(f);
+ }
+ // return pci NIC-card or nil if no if name
+ return strlen(pci) > 0 ? strdup(pci) : 0L;
+}
+
int
main(int argc, char **argv)
{
@@ -403,6 +448,8 @@ main(int argc, char **argv)
exit(1);
}
+ device = get_first_ethernet();
+
while ((ch = getopt(argc, argv, "h?bfDUAqc:w:s:I:V")) != EOF) {
switch(ch) {
case 'b':
@@ -429,6 +476,10 @@ main(int argc, char **argv)
timeout = atoi(optarg);
break;
case 'I':
+ if (device) {
+ free(device);
+ device = NULL;
+ }
device = strdup(optarg);
break;
case 'f':

View File

@ -0,0 +1,53 @@
diff -up iputils-s20101006/doc/ping.sgml.man iputils-s20101006/doc/ping.sgml
--- iputils-s20101006/doc/ping.sgml.man 2011-03-29 08:53:09.362500777 +0200
+++ iputils-s20101006/doc/ping.sgml 2011-03-29 08:58:03.196423782 +0200
@@ -62,8 +62,8 @@ Audible ping.
<term><option/-A/</term>
<listitem><para>
Adaptive ping. Interpacket interval adapts to round-trip time, so that
-effectively not more than one (or more, if preload is set) unanswered probes
-present in the network. Minimal interval is 200msec for not super-user.
+effectively not more than one (or more, if preload is set) unanswered probe
+is present in the network. Minimal interval is 200msec for not super-user.
On networks with low rtt this mode is essentially equivalent to flood mode.
</para></listitem>
</varlistentry>
@@ -394,7 +394,7 @@ probes are answered or for some error no
<term><option>-W <replaceable/timeout/</option></term>
<listitem><para>
Time to wait for a response, in seconds. The option affects only timeout
-in absense of any responses, otherwise <command/ping/ waits for two RTTs.
+in absence of any responses, otherwise <command/ping/ waits for two RTTs.
</para></listitem>
</varlistentry>
</variablelist>
@@ -535,7 +535,7 @@ or
</para>
<para>
-In normal operation ping prints the ttl value from the packet it receives.
+In normal operation ping prints the TTL value from the packet it receives.
When a remote system receives a ping packet, it can do one of three things
with the TTL field in its response:
</para>
diff -up iputils-s20101006/doc/tracepath.sgml.man iputils-s20101006/doc/tracepath.sgml
--- iputils-s20101006/doc/tracepath.sgml.man 2011-03-29 08:58:31.835723958 +0200
+++ iputils-s20101006/doc/tracepath.sgml 2011-03-29 09:01:41.706767424 +0200
@@ -35,7 +35,7 @@ privileges and has no fancy options.
<command/tracepath6/ is good replacement for <command/traceroute6/
and classic example of application of Linux error queues.
The situation with IPv4 is worse, because commercial
-IP routers do not return enough information in icmp error messages.
+IP routers do not return enough information in ICMP error messages.
Probably, it will change, when they will be updated.
For now it uses Van Jacobson's trick, sweeping a range
of UDP ports to maintain trace history.
@@ -96,7 +96,7 @@ the probe was not sent to the network.
<para>
The rest of line shows miscellaneous information about path to
-the correspinding hetwork hop. As rule it contains value of RTT.
+the correspinding network hop. As rule it contains value of RTT.
Additionally, it can show Path MTU, when it changes.
If the path is asymmetric
or the probe finishes before it reach prescribed hop, difference

View File

@ -0,0 +1,12 @@
diff -up iputils-s20100418/ping.c.rr iputils-s20100418/ping.c
--- iputils-s20100418/ping.c.rr 2011-11-24 14:33:37.096831782 +0100
+++ iputils-s20100418/ping.c 2011-11-24 14:35:53.087308660 +0100
@@ -1085,7 +1085,7 @@ void pr_options(unsigned char * cp, int
if (i <= 0)
break;
if (i == old_rrlen
- && !strncmp((char *)cp, old_rr, i)
+ && !memcmp(cp, (unsigned char *)old_rr, i)
&& !(options & F_FLOOD)) {
printf("\t(same route)");
i = ((i + 3) / 4) * 4;

View File

@ -0,0 +1,45 @@
diff -up iputils-s20101006/clockdiff.c.unused iputils-s20101006/clockdiff.c
--- iputils-s20101006/clockdiff.c.unused 2011-02-09 16:17:33.988298995 +0100
+++ iputils-s20101006/clockdiff.c 2011-02-09 16:17:52.192299138 +0100
@@ -126,7 +126,7 @@ measure(struct sockaddr_in * addr)
int msgcount;
int cc, count;
fd_set ready;
- long sendtime, recvtime, histime, histime1;
+ long sendtime, recvtime, histime;
long min1, min2, diff;
long delta1, delta2;
struct timeval tv1, tout;
@@ -240,7 +240,6 @@ empty:
rtt_sigma = (rtt_sigma *3 + abs(diff-rtt))/4;
msgcount++;
histime = ntohl(((__u32*)(icp+1))[1]);
- histime1 = ntohl(((__u32*)(icp+1))[2]);
/*
* a hosts using a time format different from
* ms. since midnight UT (as per RFC792) should
diff -up iputils-s20101006/ping6.c.unused iputils-s20101006/ping6.c
--- iputils-s20101006/ping6.c.unused 2011-02-09 16:14:11.413299738 +0100
+++ iputils-s20101006/ping6.c 2011-02-09 16:46:39.158299066 +0100
@@ -1215,7 +1215,7 @@ void pr_niquery_reply_name(struct ni_hdr
}
while (p < end) {
int fqdn = 1;
- int len;
+ int buf_len;
int i;
memset(buf, 0xff, sizeof(buf));
@@ -1230,10 +1230,10 @@ void pr_niquery_reply_name(struct ni_hdr
}
if (p + ret < end && *(p + ret) == '\0')
fqdn = 0;
- len = strlen(buf);
+ buf_len = strlen(buf);
putchar(' ');
- for (i = 0; i < strlen(buf); i++)
+ for (i = 0; i < buf_len; i++)
putchar_safe(buf[i]);
if (fqdn)
putchar('.');

View File

@ -0,0 +1,50 @@
--- iputils/ping.c.OLD 2006-02-06 10:34:35.000000000 +0100
+++ iputils/ping.c 2006-02-06 10:34:35.000000000 +0100
@@ -855,9 +855,36 @@
case ICMP_SR_FAILED:
printf("Source Route Failed\n");
break;
+ case ICMP_NET_UNKNOWN:
+ printf("Destination Net Unknown\n");
+ break;
+ case ICMP_HOST_UNKNOWN:
+ printf("Destination Host Unknown\n");
+ break;
+ case ICMP_HOST_ISOLATED:
+ printf("Source Host Isolated\n");
+ break;
+ case ICMP_NET_ANO:
+ printf("Destination Net Prohibited\n");
+ break;
+ case ICMP_HOST_ANO:
+ printf("Destination Host Prohibited\n");
+ break;
+ case ICMP_NET_UNR_TOS:
+ printf("Destination Net Unreachable for Type of Service\n");
+ break;
+ case ICMP_HOST_UNR_TOS:
+ printf("Destination Host Unreachable for Type of Service\n");
+ break;
case ICMP_PKT_FILTERED:
printf("Packet filtered\n");
break;
+ case ICMP_PREC_VIOLATION:
+ printf("Precedence Violation\n");
+ break;
+ case ICMP_PREC_CUTOFF:
+ printf("Precedence Cutoff\n");
+ break;
default:
printf("Dest Unreachable, Bad Code: %d\n", code);
break;
--- iputils/ping_common.c.OLD 2006-02-06 10:34:35.000000000 +0100
+++ iputils/ping_common.c 2006-02-06 10:34:35.000000000 +0100
@@ -819,7 +819,7 @@
printf("%spipe %d", comma, pipesize);
comma = ", ";
}
- if (ntransmitted > 1 && (!interval || (options&(F_FLOOD|F_ADAPTIVE)))) {
+ if (ntransmitted > 1 && nreceived && (!interval || (options&(F_FLOOD|F_ADAPTIVE)))) {
int ipg = (1000000*(long long)tv.tv_sec+tv.tv_usec)/(ntransmitted-1);
printf("%sipg/ewma %d.%03d/%d.%03d ms",
comma, ipg/1000, ipg%1000, rtt/8000, (rtt/8)%1000);

View File

@ -0,0 +1,18 @@
iputils-20020927-rh.patch
iputils-20020124-countermeasures.patch
iputils-20020927-addrcache.patch
iputils-20020927-ping-subint.patch
iputils-ping_cleanup.patch
iputils-20070202-idn.patch
iputils-20070202-traffic_class.patch
iputils-20070202-ia64_align.patch
iputils-20071127-warnings.patch
iputils-20071127-corr_type.patch
iputils-20071127-infiniband.patch
iputils-20100418-convtoint.patch
iputils-20101006-drop_caps.patch
iputils-20101006-unused.patch
iputils-20101006-man.patch
iputils-20101006-eth.patch
iputils-20101006-rr.patch
iputils-s20101006-manpages.patch

View File

@ -1,27 +1,37 @@
# Template file for 'iputils' # Template file for 'iputils'
pkgname=iputils pkgname=iputils
version=20101006 version=20101006
revision=2
patch_args="-Np1" patch_args="-Np1"
wrksrc="${pkgname}-s${version}" wrksrc="${pkgname}-s${version}"
#distfiles="http://www.skbuff.net/${pkgname}/${pkgname}-s${version}.tar.bz2" homepage="http://www.skbuff.net/iputils"
distfiles="http://cross-lfs.org/files/packages/svn/${pkgname}-s${version}.tar.bz2" distfiles="http://www.skbuff.net/iputils/${pkgname}-s${version}.tar.bz2"
build_style=gnu-makefile
revision=1
short_desc="IP Configuration Utilities (and ping)" short_desc="IP Configuration Utilities (and ping)"
maintainer="Juan RP <xtraeme@gmail.com>" maintainer="Juan RP <xtraeme@gmail.com>"
license="BSD"
checksum=fd3af46c80ebb99607c2ca1f2a3608b6fe828e25bbec6e54f2afd25f6ddb6ee7 checksum=fd3af46c80ebb99607c2ca1f2a3608b6fe828e25bbec6e54f2afd25f6ddb6ee7
long_desc=" long_desc="
The iputils package is set of small useful utilities for Linux networking. The iputils package is set of small useful utilities for Linux networking.
It was originally maintained by Alexey Kuznetsov." It was originally maintained by Alexey Kuznetsov."
Add_dependency build libsysfs-devel
Add_dependency build openssl-devel Add_dependency build openssl-devel
Add_dependency build libcap-devel
Add_dependency build libidn-devel
do_build() {
make ${makejobs} \
arping clockdiff ping ping6 rdisc tracepath tracepath6
}
do_install() {
for f in clockdiff arping ping ping6 rdisc tracepath tracepath6; do
vinstall ${f} 755 sbin
done
for f in clockdiff arping ping rdisc tracepath; do
vinstall doc/${f}.8 644 usr/share/man/man8
done
cd ${DESTDIR}/usr/share/man/man8
ln -s ping.8 ping6.8
ln -s tracepath.8 tracepath6.8
post_install()
{
install -d ${DESTDIR}/usr/share/man/man8
install -m644 ${wrksrc}/doc/*.8 ${DESTDIR}/usr/share/man/man8
cd ${DESTDIR}/usr/share/man/man8
ln -sf ping.8 ping6.8
ln -sf tracepath.8 tracepath6.8
} }