]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
iputils: Copy patch files into repository.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 7 Feb 2010 14:54:17 +0000 (15:54 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 7 Feb 2010 14:54:17 +0000 (15:54 +0100)
14 files changed:
pkgs/core/iputils/iputils.nm
pkgs/core/iputils/patches/iputils-ifenslave-20090202.patch [new file with mode: 0644]
pkgs/core/iputils/patches/iputils-s20071127-addrcache.patch [new file with mode: 0644]
pkgs/core/iputils/patches/iputils-s20071127-arping-infiniband.patch [new file with mode: 0644]
pkgs/core/iputils/patches/iputils-s20071127-arping_timeout.patch [new file with mode: 0644]
pkgs/core/iputils/patches/iputils-s20071127-countermeasures.patch [new file with mode: 0644]
pkgs/core/iputils/patches/iputils-s20071127-idn.patch [new file with mode: 0644]
pkgs/core/iputils/patches/iputils-s20071127-open-max.patch [new file with mode: 0644]
pkgs/core/iputils/patches/iputils-s20071127-output.patch [new file with mode: 0644]
pkgs/core/iputils/patches/iputils-s20071127-ping-subint.patch [new file with mode: 0644]
pkgs/core/iputils/patches/iputils-s20071127-ping_cleanup.patch [new file with mode: 0644]
pkgs/core/iputils/patches/iputils-s20071127-rh.patch [new file with mode: 0644]
pkgs/core/iputils/patches/iputils-s20071127-traffic_class.patch [new file with mode: 0644]
pkgs/core/iputils/patches/iputils-s20071127-warnings.patch [new file with mode: 0644]

index 452d6b4c0b9a5e284a4bf194df603aa5c1936dd7..6640a3dce0e16fd43933d5461d7fa1049fd9d227 100644 (file)
@@ -46,19 +46,6 @@ endef
 
 PKG_TARBALL    = $(THISAPP).tar.bz2
 
-PKG_PATCHES   += $(THISAPP)-addrcache.patch
-PKG_PATCHES   += $(THISAPP)-arping-infiniband.patch
-PKG_PATCHES   += $(THISAPP)-arping_timeout.patch
-PKG_PATCHES   += $(THISAPP)-countermeasures.patch
-PKG_PATCHES   += $(THISAPP)-idn.patch
-PKG_PATCHES   += $(THISAPP)-open-max.patch
-PKG_PATCHES   += $(THISAPP)-ping-subint.patch
-PKG_PATCHES   += $(THISAPP)-ping_cleanup.patch
-PKG_PATCHES   += $(THISAPP)-rh.patch
-PKG_PATCHES   += $(THISAPP)-traffic_class.patch
-PKG_PATCHES   += $(THISAPP)-warnings.patch
-PKG_PATCHES   += $(THISAPP)-output.patch
-
 ###############################################################################
 # Installation Details
 ###############################################################################
diff --git a/pkgs/core/iputils/patches/iputils-ifenslave-20090202.patch b/pkgs/core/iputils/patches/iputils-ifenslave-20090202.patch
new file mode 100644 (file)
index 0000000..662d69d
--- /dev/null
@@ -0,0 +1,13 @@
+--- iputils/ifenslave.c.addr   2006-03-29 15:00:24.000000000 +0200
++++ iputils/ifenslave.c        2006-03-29 15:02:01.000000000 +0200
+@@ -524,8 +524,8 @@
+       if (ioctl(skfd, SIOCGIFADDR, &ifr) < 0)
+               return -1;
+       printf("The result of SIOCGIFADDR is %2.2x.%2.2x.%2.2x.%2.2x.\n",
+-             ifr.ifr_addr.sa_data[0], ifr.ifr_addr.sa_data[1],
+-             ifr.ifr_addr.sa_data[2], ifr.ifr_addr.sa_data[3]);
++             ifr.ifr_addr.sa_data[2], ifr.ifr_addr.sa_data[3],
++             ifr.ifr_addr.sa_data[4], ifr.ifr_addr.sa_data[5]);
+       strcpy(ifr.ifr_name, ifname);
+       if (ioctl(skfd, SIOCGIFHWADDR, &ifr) < 0)
diff --git a/pkgs/core/iputils/patches/iputils-s20071127-addrcache.patch b/pkgs/core/iputils/patches/iputils-s20071127-addrcache.patch
new file mode 100644 (file)
index 0000000..188dbca
--- /dev/null
@@ -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);
diff --git a/pkgs/core/iputils/patches/iputils-s20071127-arping-infiniband.patch b/pkgs/core/iputils/patches/iputils-s20071127-arping-infiniband.patch
new file mode 100644 (file)
index 0000000..9884b70
--- /dev/null
@@ -0,0 +1,244 @@
+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;
+-struct sockaddr_ll me;
+-struct sockaddr_ll he;
++/*
++ * Make these two structs have padding at the end so the overly long Infiniband
++ * hardware addresses can have the remainder of their address tacked onto
++ * the end of the struct without overlapping anything.
++ */
++struct sockaddr_ll me[2];
++struct sockaddr_ll he[2];
+ 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 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);
+-      err = sendto(s, buf, p-buf, 0, (struct sockaddr*)HE, sizeof(*HE));
++      err = sendto(s, buf, p-buf, 0, (struct sockaddr*)HE, (ah->ar_hln > 8) ?
++                   sizeof(*HE) + ah->ar_hln - 8 : sizeof(*HE));
+       if (err == p-buf) {
+               last = now;
+               sent++;
+@@ -172,7 +185,7 @@ void catcher(void)
+               finish();
+       if (last.tv_sec==0 || MS_TDIFF(tv,last) > 500) {
+-              send_pack(s, src, dst, &me, &he);
++              send_pack(s, src, dst, &me[0], &he[0]);
+               if (count == 0 && unsolicited)
+                       finish();
+       }
+@@ -219,7 +232,7 @@ int recv_pack(unsigned char *buf, int le
+               return 0;
+       if (ah->ar_pln != 4)
+               return 0;
+-      if (ah->ar_hln != me.sll_halen)
++      if (ah->ar_hln != me[0].sll_halen)
+               return 0;
+       if (len < sizeof(*ah) + 2*(4 + ah->ar_hln))
+               return 0;
+@@ -230,7 +243,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, &me.sll_addr, ah->ar_hln))
++              if (memcmp(p+ah->ar_hln+4, &me[0].sll_addr, ah->ar_hln))
+                       return 0;
+       } else {
+               /* DAD packet was:
+@@ -248,7 +261,7 @@ int recv_pack(unsigned char *buf, int le
+                */
+               if (src_ip.s_addr != dst.s_addr)
+                       return 0;
+-              if (memcmp(p, &me.sll_addr, me.sll_halen) == 0)
++              if (memcmp(p, &me[0].sll_addr, me[0].sll_halen) == 0)
+                       return 0;
+               if (src.s_addr && src.s_addr != dst_ip.s_addr)
+                       return 0;
+@@ -264,7 +277,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, me.sll_addr, ah->ar_hln)) {
++              if (memcmp(p+ah->ar_hln+4, me[0].sll_addr, ah->ar_hln)) {
+                       if (!s_printed)
+                               printf("for ");
+                       printf("[");
+@@ -290,12 +303,69 @@ int recv_pack(unsigned char *buf, int le
+       if (quit_on_reply)
+               finish();
+       if(!broadcast_only) {
+-              memcpy(he.sll_addr, p, me.sll_halen);
++              memcpy(he[0].sll_addr, p, me[0].sll_halen);
+               unicasting=1;
+       }
+       return 1;
+ }
++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);
+       };
+-      me.sll_family = AF_PACKET;
+-      me.sll_ifindex = ifindex;
+-      me.sll_protocol = htons(ETH_P_ARP);
++      me[0].sll_family = AF_PACKET;
++      me[0].sll_ifindex = ifindex;
++      me[0].sll_protocol = htons(ETH_P_ARP);
+       if (bind(s, (struct sockaddr*)&me, sizeof(me)) == -1) {
+               perror("bind");
+               exit(2);
+@@ -474,14 +544,33 @@ main(int argc, char **argv)
+                       exit(2);
+               }
+       }
+-      if (me.sll_halen == 0) {
++      if (me[0].sll_halen == 0) {
+               if (!quiet)
+                       printf("Interface \"%s\" is not ARPable (no ll address)\n", device);
+               exit(dad?0:2);
+       }
++      he[0] = me[0];
++      he[1] = me[1];
++      {
++                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,12 +590,12 @@ main(int argc, char **argv)
+       while(1) {
+               sigset_t sset, osset;
+               unsigned char packet[4096];
+-              struct sockaddr_ll from;
++              struct sockaddr_ll from[2];
+               socklen_t alen = sizeof(from);
+               int cc;
+               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);
+-              recv_pack(packet, cc, &from);
++              recv_pack(packet, cc, &from[0]);
+               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),)
diff --git a/pkgs/core/iputils/patches/iputils-s20071127-arping_timeout.patch b/pkgs/core/iputils/patches/iputils-s20071127-arping_timeout.patch
new file mode 100644 (file)
index 0000000..656ec0b
--- /dev/null
@@ -0,0 +1,65 @@
+diff -up iputils-s20070202/arping.c.arping_timeout iputils-s20070202/arping.c
+--- iputils-s20070202/arping.c.arping_timeout  2008-02-18 16:51:36.000000000 +0100
++++ iputils-s20070202/arping.c 2008-02-18 16:54:03.000000000 +0100
+@@ -45,7 +45,8 @@ struct in_addr src, dst;
+ char *target;
+ int dad, unsolicited, advert;
+ int quiet;
+-int count=-1;
++int count;
++int forever = 1;
+ int timeout;
+ int unicasting;
+ int s;
+@@ -59,7 +60,7 @@ int broadcast_only;
+ struct sockaddr_ll me[2];
+ struct sockaddr_ll he[2];
+-struct timeval start, last;
++struct timeval last;
+ int sent, brd_sent;
+ int received, brd_recv, req_recv;
+@@ -172,13 +173,15 @@ void catcher(void)
+       gettimeofday(&tv, NULL);
+-      if (start.tv_sec==0)
+-              start = tv;
+-
+-      if (count-- == 0 || (timeout && MS_TDIFF(tv,start) > timeout*1000 + 500))
+-              finish();
++      if (!forever && count == 0) {
++              if (timeout && MS_TDIFF(tv, last) > timeout * 1000 + 500)
++                      finish();
++              else if (!timeout)
++                      finish();
++      }
+-      if (last.tv_sec==0 || MS_TDIFF(tv,last) > 500) {
++      if ((count > 0 || forever) && (last.tv_sec == 0 || MS_TDIFF(tv, last) > 500)) {
++              count--;
+               send_pack(s, src, dst, &me[0], &he[0]);
+               if (count == 0 && unsolicited)
+                       finish();
+@@ -339,6 +342,10 @@ main(int argc, char **argv)
+                       break;
+               case 'c':
+                       count = atoi(optarg);
++                      if (count > 0)
++                              forever = 0;
++                      else
++                              forever = 1;
+                       break;
+               case 'w':
+                       timeout = atoi(optarg);
+@@ -544,7 +551,8 @@ main(int argc, char **argv)
+               sigaddset(&sset, SIGALRM);
+               sigaddset(&sset, SIGINT);
+               sigprocmask(SIG_BLOCK, &sset, &osset);
+-              recv_pack(packet, cc, &from[0]);
++              if (recv_pack(packet, cc, from) && count == 0 && !forever)
++                      finish();
+               sigprocmask(SIG_SETMASK, &osset, NULL);
+       }
+ }
diff --git a/pkgs/core/iputils/patches/iputils-s20071127-countermeasures.patch b/pkgs/core/iputils/patches/iputils-s20071127-countermeasures.patch
new file mode 100644 (file)
index 0000000..5e6f4bc
--- /dev/null
@@ -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);
diff --git a/pkgs/core/iputils/patches/iputils-s20071127-idn.patch b/pkgs/core/iputils/patches/iputils-s20071127-idn.patch
new file mode 100644 (file)
index 0000000..b575006
--- /dev/null
@@ -0,0 +1,130 @@
+--- iputils-s20070202/ping.c.idn       2007-08-06 14:45:36.000000000 +0200
++++ iputils-s20070202/ping.c   2007-08-06 14:45:36.000000000 +0200
+@@ -58,6 +58,9 @@
+  *    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>
+@@ -122,6 +128,10 @@
+       char *target, hnamebuf[MAXHOSTNAMELEN];
+       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;
+@@ -242,13 +254,27 @@
+                       if (argc == 1)
+                               options |= F_NUMERIC;
+               } else {
++                      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);
+-                      hp = gethostbyname(target);
+                       if (!hp) {
+                               fprintf(stderr, "ping: unknown host %s\n", target);
+                               exit(2);
+                       }
+                       memcpy(&whereto.sin_addr, hp->h_addr, 4);
++                      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);
+-                      strncpy(hnamebuf, hp->h_name, sizeof(hnamebuf) - 1);
+                       hnamebuf[sizeof(hnamebuf) - 1] = 0;
+                       hostname = hnamebuf;
+               }
+--- iputils-s20070202/Makefile.idn     2007-08-06 14:45:36.000000000 +0200
++++ iputils-s20070202/Makefile 2007-08-06 14:45:36.000000000 +0200
+@@ -27,8 +27,13 @@
+ tftpd: tftpd.o tftpsubs.o
++
+ ping: ping.o ping_common.o
++      $(CC) $(CFLAGS) ping.o ping_common.o -lidn -o ping
++
+ ping6: ping6.o ping_common.o
++      $(CC) $(CFLAGS) ping6.o ping_common.o -o ping6
++
+ ping.o ping6.o ping_common.o: ping_common.h
+ tftpd.o tftpsubs.o: tftp.h
+--- iputils-s20070202/ping6.c.idn      2007-08-06 14:45:36.000000000 +0200
++++ iputils-s20070202/ping6.c  2007-08-06 14:45:36.000000000 +0200
+@@ -66,6 +66,9 @@
+  *    More statistics could always be gathered.
+  *    This program has to run SUID to ROOT to access the ICMP socket.
+  */
++#define _GNU_SOURCE
++#include <locale.h>
++
+ #include "ping_common.h"
+ #include <linux/filter.h>
+@@ -210,6 +216,8 @@
+       int err, csum_offset, sz_opt;
+       static uint32_t scope_id = 0;
++      setlocale(LC_ALL, "");
++
+       icmp_sock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
+       socket_errno = errno;
+@@ -296,6 +306,7 @@
+               memset(&hints, 0, sizeof(hints));
+               hints.ai_family = AF_INET6;
++              hints.ai_flags = AI_IDN;
+               gai = getaddrinfo(target, NULL, &hints, &ai);
+               if (gai) {
+                       fprintf(stderr, "unknown host\n");
+@@ -328,6 +341,7 @@
+       memset(&hints, 0, sizeof(hints));
+       hints.ai_family = AF_INET6;
++      hints.ai_flags = AI_IDN;
+       gai = getaddrinfo(target, NULL, &hints, &ai);
+       if (gai) {
+               fprintf(stderr, "unknown host\n");
+--- iputils-s20070202/ping_common.c.idn        2007-08-06 14:45:36.000000000 +0200
++++ iputils-s20070202/ping_common.c    2007-08-06 14:47:41.000000000 +0200
+@@ -1,3 +1,5 @@
++#include <locale.h>
++
+ #include "ping_common.h"
+ #include <ctype.h>
+ #include <sched.h>
+@@ -97,6 +102,7 @@
+ void common_options(int ch)
+ {
++      setlocale(LC_ALL, "C");
+       switch(ch) {
+       case 'a':
+               options |= F_AUDIBLE;
+@@ -222,6 +230,7 @@
+       default:
+               abort();
+       }
++      setlocale(LC_ALL, "");
+ }
diff --git a/pkgs/core/iputils/patches/iputils-s20071127-open-max.patch b/pkgs/core/iputils/patches/iputils-s20071127-open-max.patch
new file mode 100644 (file)
index 0000000..d8ce652
--- /dev/null
@@ -0,0 +1,30 @@
+diff -up iputils-s20071127/rdisc.c.open_max iputils-s20071127/rdisc.c
+--- iputils-s20071127/rdisc.c.open_max 2008-02-25 11:15:37.000000000 +0100
++++ iputils-s20071127/rdisc.c  2008-02-25 11:17:30.000000000 +0100
+@@ -240,14 +240,25 @@ void do_fork(void)
+ {
+       int t;
+       pid_t pid;
++      long open_max;
+       if (trace)
+               return;
++      if ((open_max = sysconf(_SC_OPEN_MAX)) == -1) {
++              if (errno == 0) {
++                      (void) fprintf(stderr, "OPEN_MAX is not supported\n");
++              } 
++              else {
++                      (void) fprintf(stderr, "sysconf() error\n");
++              }
++              exit(1);
++      }
++
+       if ((pid=fork()) != 0)
+               exit(0);
+-      for (t = 0; t < OPEN_MAX; t++)
++      for (t = 0; t < open_max; t++)
+               if (t != s)
+                       close(t);
diff --git a/pkgs/core/iputils/patches/iputils-s20071127-output.patch b/pkgs/core/iputils/patches/iputils-s20071127-output.patch
new file mode 100644 (file)
index 0000000..365169b
--- /dev/null
@@ -0,0 +1,34 @@
+diff -up iputils-s20071127/ping_common.c.output iputils-s20071127/ping_common.c
+--- iputils-s20071127/ping_common.c.output     2008-02-26 14:12:02.000000000 +0100
++++ iputils-s20071127/ping_common.c    2008-02-26 14:24:34.000000000 +0100
+@@ -791,8 +791,10 @@ static long llsqrt(long long a)
+  */
+ void finish(void)
+ {
+-      struct timeval tv = cur_time;
++      struct timeval tv;
++      char *comma = "";
++      gettimeofday(&tv, NULL);
+       tvsub(&tv, &start_time);
+       putchar('\n');
+@@ -827,12 +829,15 @@ void finish(void)
+                      (long)tmax/1000, (long)tmax%1000,
+                      (long)tmdev/1000, (long)tmdev%1000
+                      );
++              comma = ", ";
++      }
++      if (pipesize > 1) {
++              printf("%spipe %d", comma, pipesize);
++              comma = ", ";
+       }
+-      if (pipesize > 1)
+-              printf(", pipe %d", pipesize);
+       if (ntransmitted > 1 && nreceived && (!interval || (options&(F_FLOOD|F_ADAPTIVE)))) {
+               int ipg = (1000000*(long long)tv.tv_sec+tv.tv_usec)/(ntransmitted-1);
+-              printf(", ipg/ewma %d.%03d/%d.%03d ms",
++              printf("%sipg/ewma %d.%03d/%d.%03d ms", comma,
+                      ipg/1000, ipg%1000, rtt/8000, (rtt/8)%1000);
+       }
+       putchar('\n');
diff --git a/pkgs/core/iputils/patches/iputils-s20071127-ping-subint.patch b/pkgs/core/iputils/patches/iputils-s20071127-ping-subint.patch
new file mode 100644 (file)
index 0000000..e19e724
--- /dev/null
@@ -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");
+                               }
+                       }
+               }
diff --git a/pkgs/core/iputils/patches/iputils-s20071127-ping_cleanup.patch b/pkgs/core/iputils/patches/iputils-s20071127-ping_cleanup.patch
new file mode 100644 (file)
index 0000000..071ab82
--- /dev/null
@@ -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 @@
+       }
+       if (pipesize > 1)
+               printf(", pipe %d", pipesize);
+-      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(", ipg/ewma %d.%03d/%d.%03d ms",
+                      ipg/1000, ipg%1000, rtt/8000, (rtt/8)%1000);
diff --git a/pkgs/core/iputils/patches/iputils-s20071127-rh.patch b/pkgs/core/iputils/patches/iputils-s20071127-rh.patch
new file mode 100644 (file)
index 0000000..16d4745
--- /dev/null
@@ -0,0 +1,13 @@
+--- iputils/Makefile.rh7       2002-09-20 20:23:55.000000000 +0200
++++ iputils/Makefile   2004-05-12 15:08:25.638310270 +0200
+@@ -24,8 +24,8 @@
+ 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?=-D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -g
++CFLAGS?=$(CCOPT) $(GLIBCFIX) $(DEFINES) 
+ IPV4_TARGETS=tracepath ping clockdiff rdisc arping tftpd rarpd
+ IPV6_TARGETS=tracepath6 traceroute6 ping6
diff --git a/pkgs/core/iputils/patches/iputils-s20071127-traffic_class.patch b/pkgs/core/iputils/patches/iputils-s20071127-traffic_class.patch
new file mode 100644 (file)
index 0000000..8a4ddf0
--- /dev/null
@@ -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
diff --git a/pkgs/core/iputils/patches/iputils-s20071127-warnings.patch b/pkgs/core/iputils/patches/iputils-s20071127-warnings.patch
new file mode 100644 (file)
index 0000000..a2d0a83
--- /dev/null
@@ -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
+@@ -667,7 +667,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
+@@ -690,7 +690,7 @@ int receive_error_msg()
+               if (options & F_QUIET)
+                       goto out;
+               if (options & F_FLOOD) {
+-                      write(STDOUT_FILENO, "\bE", 2);
++                      printf("\bE");
+               } else {
+                       printf("From %s icmp_seq=%u ", pr_addr(&sin6->sin6_addr), ntohs(icmph.icmp6_seq));
+                       pr_icmph(e->ee_type, e->ee_code, e->ee_info);
+@@ -838,7 +838,7 @@ parse_reply(struct msghdr *msg, int cc, 
+                               return 0;
+                       nerrors++;
+                       if (options & F_FLOOD) {
+-                              write(STDOUT_FILENO, "\bE", 2);
++                              printf("\bE");
+                               return 0;
+                       }
+                       printf("From %s: icmp_seq=%u ", pr_addr(&from->sin6_addr), ntohs(icmph1->icmp6_seq));
+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 {
+                       printf("From %s icmp_seq=%u ", pr_addr(sin->sin_addr.s_addr), ntohs(icmph.un.echo.sequence));
+                       pr_icmph(e->ee_type, e->ee_code, e->ee_info, NULL);
+@@ -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;
+                               }
+                               printf("From %s: icmp_seq=%u ",
+@@ -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)