Accepting request 42903 from network:utilities
Copy from network:utilities/iputils based on submit request 42903 from user sax2 OBS-URL: https://build.opensuse.org/request/show/42903 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/iputils?expand=0&rev=13
This commit is contained in:
commit
3bac354875
@ -1,12 +1,12 @@
|
||||
--- Makefile
|
||||
+++ Makefile
|
||||
@@ -5,8 +5,8 @@
|
||||
--- Makefile 2010-07-14 13:38:32.257045463 +0200
|
||||
+++ Makefile 2010-07-14 13:39:00.482319644 +0200
|
||||
@@ -4,8 +4,8 @@
|
||||
DEFINES=
|
||||
|
||||
#options if you have a bind>=4.9.4 libresolv (or, maybe, glibc)
|
||||
-LDLIBS=-lresolv
|
||||
-LDLIBS=
|
||||
ADDLIB=
|
||||
+LDLIBS=-lresolv $(ADDLIB)
|
||||
|
||||
ifeq ($(LIBC_INCLUDE)/socketbits.h,$(wildcard $(LIBC_INCLUDE)/socketbits.h))
|
||||
ifeq ($(LIBC_INCLUDE)/net/if_packet.h,$(wildcard $(LIBC_INCLUDE)/net/if_packet.h))
|
||||
#options if you compile with libc5, and without a bind>=4.9.4 libresolv
|
||||
# NOT AVAILABLE. Please, use libresolv.
|
||||
|
@ -1,11 +0,0 @@
|
||||
--- ping_common.c
|
||||
+++ ping_common.c
|
||||
@@ -548,7 +548,7 @@
|
||||
|
||||
/* If we are here, recvmsg() is unable to wait for
|
||||
* required timeout. */
|
||||
- if (1000*next <= 1000000/(int)HZ) {
|
||||
+ if (1000*next <= 1000000/(int)sysconf(_SC_CLK_TCK)) {
|
||||
/* Very short timeout... So, if we wait for
|
||||
* something, we sleep for MININTERVAL.
|
||||
* Otherwise, spin! */
|
16
iputils-arping-set_device_broadcast.diff
Normal file
16
iputils-arping-set_device_broadcast.diff
Normal file
@ -0,0 +1,16 @@
|
||||
--- arping.c
|
||||
+++ arping.c
|
||||
@@ -335,8 +335,8 @@ void set_device_broadcast(char *device, unsigned char *ba, size_t balen)
|
||||
exit(2);
|
||||
}
|
||||
|
||||
- for (p = ba, ch = 0; p < ba + balen; p++, ch += 3)
|
||||
- *p++ = strtoul(brdcast->value + ch * 3, NULL, 16);
|
||||
+ for (p = ba, ch = 0; p < ba + balen; ch += 3)
|
||||
+ *p++ = strtoul(brdcast->value + ch, NULL, 16);
|
||||
|
||||
return;
|
||||
}
|
||||
--
|
||||
1.7.1
|
||||
|
@ -1,41 +0,0 @@
|
||||
--- arping.c
|
||||
+++ arping.c
|
||||
@@ -17,8 +17,10 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/ioctl.h>
|
||||
-#include <linux/if.h>
|
||||
-#include <linux/if_arp.h>
|
||||
+#include <net/if.h>
|
||||
+#include <net/if_arp.h>
|
||||
+#include <netpacket/packet.h>
|
||||
+#include <linux/if_ether.h>
|
||||
#include <sys/uio.h>
|
||||
|
||||
#include <netdb.h>
|
||||
--- rarpd.c
|
||||
+++ rarpd.c
|
||||
@@ -24,10 +24,11 @@
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/signal.h>
|
||||
-#include <linux/if.h>
|
||||
-#include <linux/if_arp.h>
|
||||
+#include <net/if.h>
|
||||
+#include <net/if_arp.h>
|
||||
#include <netinet/in.h>
|
||||
-#include <linux/if_packet.h>
|
||||
+#include <netpacket/packet.h>
|
||||
+#include <linux/if_ether.h>
|
||||
#include <linux/filter.h>
|
||||
|
||||
int do_reload = 1;
|
||||
@@ -45,6 +46,8 @@
|
||||
extern int ether_ntohost(char *name, unsigned char *ea);
|
||||
void usage(void) __attribute__((noreturn));
|
||||
|
||||
+#define ifaddr if_addr
|
||||
+
|
||||
struct iflink
|
||||
{
|
||||
struct iflink *next;
|
@ -1,6 +1,6 @@
|
||||
diff -ur iputils/ping.c iputils.new/ping.c
|
||||
--- iputils/ping.c 2004-03-17 12:36:43.000000000 +0100
|
||||
+++ iputils.new/ping.c 2004-03-17 12:35:49.000000000 +0100
|
||||
--- ping.c 2004-03-17 12:36:43.000000000 +0100
|
||||
+++ ping.c 2004-03-17 12:35:49.000000000 +0100
|
||||
@@ -1141,15 +1141,24 @@
|
||||
char *
|
||||
pr_addr(__u32 addr)
|
||||
@ -32,8 +32,8 @@ diff -ur iputils/ping.c iputils.new/ping.c
|
||||
}
|
||||
|
||||
diff -ur iputils/ping6.c iputils.new/ping6.c
|
||||
--- iputils/ping6.c 2004-03-17 12:36:43.000000000 +0100
|
||||
+++ iputils.new/ping6.c 2004-03-17 12:36:29.000000000 +0100
|
||||
--- ping6.c 2004-03-17 12:36:43.000000000 +0100
|
||||
+++ ping6.c 2004-03-17 12:36:29.000000000 +0100
|
||||
@@ -898,11 +898,22 @@
|
||||
char * pr_addr(struct in6_addr *addr)
|
||||
{
|
@ -1,209 +0,0 @@
|
||||
--- arping.c 2010-05-31 17:21:39.000000000 +0530
|
||||
+++ arping.c 2010-05-31 17:33:04.000000000 +0530
|
||||
@@ -32,6 +32,8 @@
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
+#include <sysfs/libsysfs.h>
|
||||
+
|
||||
#include "SNAPSHOT.h"
|
||||
|
||||
static void usage(void) __attribute__((noreturn));
|
||||
@@ -50,8 +52,8 @@
|
||||
int s;
|
||||
int broadcast_only;
|
||||
|
||||
-struct sockaddr_ll me;
|
||||
-struct sockaddr_ll he;
|
||||
+struct sockaddr_storage me;
|
||||
+struct sockaddr_storage he;
|
||||
|
||||
struct timeval start, last;
|
||||
|
||||
@@ -61,6 +63,18 @@
|
||||
#define MS_TDIFF(tv1,tv2) ( ((tv1).tv_sec-(tv2).tv_sec)*1000 + \
|
||||
((tv1).tv_usec-(tv2).tv_usec)/1000 )
|
||||
|
||||
+#define OFFSET_OF(name,ele) ((size_t)(((name *)0)->ele))
|
||||
+
|
||||
+static inline socklen_t sll_len(size_t halen)
|
||||
+{
|
||||
+ socklen_t len = OFFSET_OF(struct sockaddr_ll, sll_addr) + halen;
|
||||
+ if (len < sizeof(struct sockaddr_ll))
|
||||
+ len = sizeof(struct sockaddr_ll);
|
||||
+ return len;
|
||||
+}
|
||||
+
|
||||
+#define SLL_LEN(hln) sll_len(hln)
|
||||
+
|
||||
void usage(void)
|
||||
{
|
||||
fprintf(stderr,
|
||||
@@ -124,7 +138,7 @@
|
||||
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, SLL_LEN(ah->ar_hln));
|
||||
if (err == p-buf) {
|
||||
last = now;
|
||||
sent++;
|
||||
@@ -172,7 +186,8 @@
|
||||
finish();
|
||||
|
||||
if (last.tv_sec==0 || MS_TDIFF(tv,last) > 500) {
|
||||
- send_pack(s, src, dst, &me, &he);
|
||||
+ send_pack(s, src, dst,
|
||||
+ (struct sockaddr_ll *)&me, (struct sockaddr_ll *)&he);
|
||||
if (count == 0 && unsolicited)
|
||||
finish();
|
||||
}
|
||||
@@ -219,7 +234,7 @@
|
||||
return 0;
|
||||
if (ah->ar_pln != 4)
|
||||
return 0;
|
||||
- if (ah->ar_hln != me.sll_halen)
|
||||
+ if (ah->ar_hln != ((struct sockaddr_ll *)&me)->sll_halen)
|
||||
return 0;
|
||||
if (len < sizeof(*ah) + 2*(4 + ah->ar_hln))
|
||||
return 0;
|
||||
@@ -230,7 +245,7 @@
|
||||
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, ((struct sockaddr_ll *)&me)->sll_addr, ah->ar_hln))
|
||||
return 0;
|
||||
} else {
|
||||
/* DAD packet was:
|
||||
@@ -248,7 +263,7 @@
|
||||
*/
|
||||
if (src_ip.s_addr != dst.s_addr)
|
||||
return 0;
|
||||
- if (memcmp(p, &me.sll_addr, me.sll_halen) == 0)
|
||||
+ if (memcmp(p, ((struct sockaddr_ll *)&me)->sll_addr, ((struct sockaddr_ll *)&me)->sll_halen) == 0)
|
||||
return 0;
|
||||
if (src.s_addr && src.s_addr != dst_ip.s_addr)
|
||||
return 0;
|
||||
@@ -264,7 +279,7 @@
|
||||
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, ((struct sockaddr_ll *)&me)->sll_addr, ah->ar_hln)) {
|
||||
if (!s_printed)
|
||||
printf("for ");
|
||||
printf("[");
|
||||
@@ -290,12 +305,42 @@
|
||||
if (quit_on_reply)
|
||||
finish();
|
||||
if(!broadcast_only) {
|
||||
- memcpy(he.sll_addr, p, me.sll_halen);
|
||||
+ memcpy(((struct sockaddr_ll *)&he)->sll_addr, p, ((struct sockaddr_ll *)&me)->sll_halen);
|
||||
unicasting=1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
+void set_device_broadcast(char *device, unsigned char *ba, size_t balen)
|
||||
+{
|
||||
+ struct sysfs_class_device *dev;
|
||||
+ struct sysfs_attribute *brdcast;
|
||||
+ unsigned char *p;
|
||||
+ int ch;
|
||||
+
|
||||
+ dev = sysfs_open_class_device("net", device);
|
||||
+ if (!dev) {
|
||||
+ perror("sysfs_open_class_device(net)");
|
||||
+ exit(2);
|
||||
+ }
|
||||
+
|
||||
+ brdcast = sysfs_get_classdev_attr(dev, "broadcast");
|
||||
+ if (!brdcast) {
|
||||
+ perror("sysfs_get_classdev_attr(broadcast)");
|
||||
+ exit(2);
|
||||
+ }
|
||||
+
|
||||
+ if (sysfs_read_attribute(brdcast)) {
|
||||
+ perror("sysfs_read_attribute");
|
||||
+ exit(2);
|
||||
+ }
|
||||
+
|
||||
+ for (p = ba, ch = 0; p < ba + balen; p++, ch += 3)
|
||||
+ *p++ = strtoul(brdcast->value + ch * 3, NULL, 16);
|
||||
+
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
@@ -456,9 +501,9 @@
|
||||
close(probe_fd);
|
||||
};
|
||||
|
||||
- me.sll_family = AF_PACKET;
|
||||
- me.sll_ifindex = ifindex;
|
||||
- me.sll_protocol = htons(ETH_P_ARP);
|
||||
+ ((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) {
|
||||
perror("bind");
|
||||
exit(2);
|
||||
@@ -471,14 +516,20 @@
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
- if (me.sll_halen == 0) {
|
||||
+ if (((struct sockaddr_ll *)&me)->sll_halen == 0) {
|
||||
if (!quiet)
|
||||
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);
|
||||
+
|
||||
+#if 1
|
||||
+ set_device_broadcast(device, ((struct sockaddr_ll *)&he)->sll_addr,
|
||||
+ ((struct sockaddr_ll *)&he)->sll_halen);
|
||||
+#else
|
||||
+ memset(((struct sockaddr_ll *)&he)->sll_addr, -1, ((struct sockaddr_ll *)&he)->sll_halen);
|
||||
+#endif
|
||||
|
||||
if (!quiet) {
|
||||
printf("ARPING %s ", inet_ntoa(dst));
|
||||
@@ -498,7 +549,7 @@
|
||||
while(1) {
|
||||
sigset_t sset, osset;
|
||||
char packet[4096];
|
||||
- struct sockaddr_ll from;
|
||||
+ struct sockaddr_storage from;
|
||||
int alen = sizeof(from);
|
||||
int cc;
|
||||
|
||||
@@ -507,11 +558,12 @@
|
||||
perror("arping: recvfrom");
|
||||
continue;
|
||||
}
|
||||
+
|
||||
sigemptyset(&sset);
|
||||
sigaddset(&sset, SIGALRM);
|
||||
sigaddset(&sset, SIGINT);
|
||||
sigprocmask(SIG_BLOCK, &sset, &osset);
|
||||
- recv_pack(packet, cc, &from);
|
||||
+ recv_pack(packet, cc, (struct sockaddr_ll *)&from);
|
||||
sigprocmask(SIG_SETMASK, &osset, NULL);
|
||||
}
|
||||
}
|
||||
--- Makefile 2010-05-31 17:21:39.000000000 +0530
|
||||
+++ Makefile 2010-05-31 17:23:05.000000000 +0530
|
||||
@@ -41,6 +41,7 @@
|
||||
|
||||
|
||||
tftpd: tftpd.o tftpsubs.o
|
||||
+arping: arping.o -lsysfs
|
||||
ping: ping.o ping_common.o
|
||||
ping6: ping6.o ping_common.o
|
||||
ping.o ping6.o ping_common.o: ping_common.h
|
@ -1,50 +0,0 @@
|
||||
|
||||
This patch for iputils allows to use the standard
|
||||
|
||||
ping6 link-local-addr%interface
|
||||
|
||||
syntax instead of ping6 -I interface link-local-addr. This matches
|
||||
BSD ping.
|
||||
|
||||
Please apply.
|
||||
|
||||
-Andi
|
||||
|
||||
|
||||
diff -u iputils/ping6.c-o iputils/ping6.c
|
||||
--- iputils/ping6.c-o 2005-07-08 02:21:34.000000000 +0200
|
||||
+++ iputils/ping6.c 2005-07-08 02:51:47.000000000 +0200
|
||||
@@ -268,6 +268,14 @@
|
||||
|
||||
target = *argv;
|
||||
|
||||
+ if (!device) {
|
||||
+ char *s = strchr(target, '%');
|
||||
+ if (s) {
|
||||
+ device = s+1;
|
||||
+ *s = 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (inet_pton(AF_INET6, target, &addr) <= 0) {
|
||||
struct hostent *hp;
|
||||
|
||||
@@ -296,6 +304,14 @@
|
||||
memset(&whereto, 0, sizeof(struct sockaddr_in6));
|
||||
whereto.sin6_family = AF_INET6;
|
||||
whereto.sin6_port = htons(IPPROTO_ICMPV6);
|
||||
+
|
||||
+ if (!device) {
|
||||
+ char *s = strchr(target, '%');
|
||||
+ if (s) {
|
||||
+ device = s+1;
|
||||
+ *s = 0;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
if (inet_pton(AF_INET6, target, &whereto.sin6_addr) <= 0) {
|
||||
struct hostent *hp;
|
||||
|
||||
|
||||
|
||||
--
|
@ -1,13 +0,0 @@
|
||||
Index: iputils/rdisc.c
|
||||
===================================================================
|
||||
--- iputils.orig/rdisc.c 2007-12-12 15:41:01.000000000 +0100
|
||||
+++ iputils/rdisc.c 2007-12-12 15:42:15.000000000 +0100
|
||||
@@ -246,7 +246,7 @@ void do_fork(void)
|
||||
if ((pid=fork()) != 0)
|
||||
exit(0);
|
||||
|
||||
- for (t = 0; t < OPEN_MAX; t++)
|
||||
+ for (t = 0; t < sysconf(_SC_OPEN_MAX); t++)
|
||||
if (t != s)
|
||||
close(t);
|
||||
|
@ -1,22 +0,0 @@
|
||||
--- iputils/doc/ping.8
|
||||
+++ iputils/doc/ping.8
|
||||
@@ -118,7 +118,7 @@
|
||||
when finished.
|
||||
.TP
|
||||
\fB-R\fR
|
||||
-Record route.
|
||||
+Record route. (IPv4 only)
|
||||
Includes the RECORD_ROUTE option in the ECHO_REQUEST
|
||||
packet and displays the route buffer on returned packets.
|
||||
Note that the IP header is only large enough for nine such routes.
|
||||
--- iputils/doc/ping.sgml
|
||||
+++ iputils/doc/ping.sgml
|
||||
@@ -200,7 +200,7 @@
|
||||
<varlistentry>
|
||||
<term><option/-R/</term>
|
||||
<listitem><para>
|
||||
-Record route.
|
||||
+Record route. (IPv4 only)
|
||||
Includes the RECORD_ROUTE option in the ECHO_REQUEST
|
||||
packet and displays the route buffer on returned packets.
|
||||
Note that the IP header is only large enough for nine such routes.
|
@ -1,29 +0,0 @@
|
||||
--- ping.c 2008-08-18 11:19:05.000000000 +0200
|
||||
+++ ping.c 2008-08-18 11:19:10.000000000 +0200
|
||||
@@ -95,6 +95,7 @@
|
||||
static u_short in_cksum(const u_short *addr, int len, u_short salt);
|
||||
static void pr_icmph(__u8 type, __u8 code, __u32 info, struct icmphdr *icp);
|
||||
static int parsetos(char *str);
|
||||
+static void doexit (int);
|
||||
|
||||
static struct {
|
||||
struct cmsghdr cm;
|
||||
@@ -237,6 +238,8 @@
|
||||
options |= F_SOURCEROUTE;
|
||||
}
|
||||
}
|
||||
+ set_signal(SIGINT, doexit);
|
||||
+
|
||||
while (argc > 0) {
|
||||
target = *argv;
|
||||
|
||||
@@ -1231,3 +1234,9 @@
|
||||
" [ -T timestamp option ] [ -Q tos ] [hop1 ...] destination\n");
|
||||
exit(2);
|
||||
}
|
||||
+
|
||||
+static void doexit(int signo)
|
||||
+{
|
||||
+ exit (1);
|
||||
+}
|
||||
+
|
@ -1,76 +0,0 @@
|
||||
--- ping6.c 2006-11-15 17:05:29.000000000 +0900
|
||||
+++ ping6.c 2006-11-22 18:50:58.000000000 +0900
|
||||
@@ -196,6 +196,7 @@ int main(int argc, char *argv[])
|
||||
int socket_errno;
|
||||
struct icmp6_filter filter;
|
||||
int err, csum_offset, sz_opt;
|
||||
+ struct addrinfo hints, *res0;
|
||||
|
||||
icmp_sock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
|
||||
socket_errno = errno;
|
||||
@@ -211,6 +212,11 @@ int main(int argc, char *argv[])
|
||||
memset(&firsthop, 0, sizeof(firsthop));
|
||||
firsthop.sin6_family = AF_INET6;
|
||||
|
||||
+ memset(&hints, 0, sizeof(hints));
|
||||
+ hints.ai_family = AF_INET6;
|
||||
+ hints.ai_socktype = SOCK_RAW;
|
||||
+ hints.ai_protocol = IPPROTO_ICMPV6;
|
||||
+
|
||||
preload = 1;
|
||||
while ((ch = getopt(argc, argv, COMMON_OPTSTR "F:")) != EOF) {
|
||||
switch(ch) {
|
||||
@@ -291,16 +297,20 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (inet_pton(AF_INET6, target, &addr) <= 0) {
|
||||
- struct hostent *hp;
|
||||
-
|
||||
- hp = gethostbyname2(target, AF_INET6);
|
||||
-
|
||||
- if (hp == NULL) {
|
||||
+ err = getaddrinfo(target, NULL, &hints, &res0);
|
||||
+ if (err) {
|
||||
fprintf(stderr, "unknown host %s\n", target);
|
||||
exit(2);
|
||||
}
|
||||
+ if (res0->ai_addrlen > sizeof(struct sockaddr_in6)) {
|
||||
+ fprintf(stderr, "address length is too long\n");
|
||||
+ exit(2);
|
||||
+ }
|
||||
|
||||
- memcpy(&addr, hp->h_addr_list[0], 16);
|
||||
+ addr=((struct sockaddr_in6 *)res0->ai_addr)->sin6_addr;
|
||||
+ if (ipv6_addr_any(&firsthop.sin6_addr))
|
||||
+ memcpy(&firsthop, res0->ai_addr, res0->ai_addrlen);
|
||||
+ freeaddrinfo(res0);
|
||||
}
|
||||
|
||||
inet6_srcrt_add(srcrt, &addr);
|
||||
@@ -328,16 +338,20 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (inet_pton(AF_INET6, target, &whereto.sin6_addr) <= 0) {
|
||||
- struct hostent *hp;
|
||||
-
|
||||
- hp = gethostbyname2(target, AF_INET6);
|
||||
-
|
||||
- if (hp == NULL) {
|
||||
+ err = getaddrinfo(target, NULL, &hints, &res0);
|
||||
+ if (err) {
|
||||
fprintf(stderr, "unknown host\n");
|
||||
exit(2);
|
||||
}
|
||||
+ if (res0->ai_addrlen > sizeof(struct sockaddr_in6)) {
|
||||
+ fprintf(stderr, "address length is too long\n");
|
||||
+ exit(2);
|
||||
+ }
|
||||
|
||||
- memcpy(&whereto.sin6_addr, hp->h_addr_list[0], 16);
|
||||
+ memcpy(&whereto, res0->ai_addr, res0->ai_addrlen);
|
||||
+ if (ipv6_addr_any(&firsthop.sin6_addr))
|
||||
+ memcpy(&firsthop, res0->ai_addr, res0->ai_addrlen);
|
||||
+ freeaddrinfo(res0);
|
||||
} else {
|
||||
options |= F_NUMERIC;
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
diff -Nru iputils-orig/ping6.c iputils/ping6.c
|
||||
--- iputils-orig/ping6.c 2005-12-05 18:06:39.000000000 +0100
|
||||
+++ iputils/ping6.c 2005-12-05 18:06:49.000000000 +0100
|
||||
@@ -101,6 +101,20 @@
|
||||
#define HAVE_SIN6_SCOPEID 1
|
||||
#endif
|
||||
|
||||
+/* Begin hack KERNEL >= 2.6.1x.x */
|
||||
+#define IPV6_ADDRFORM 1
|
||||
+#define IPV6_PKTINFO 2
|
||||
+#define IPV6_HOPOPTS 3
|
||||
+#define IPV6_DSTOPTS 4
|
||||
+#define IPV6_RTHDR 5
|
||||
+#define IPV6_PKTOPTIONS 6
|
||||
+#define IPV6_CHECKSUM 7
|
||||
+#define IPV6_HOPLIMIT 8
|
||||
+#define IPV6_NEXTHOP 9
|
||||
+#define IPV6_FLOWINFO 11
|
||||
+/* End hack */
|
||||
+
|
||||
+
|
||||
|
||||
__u32 flowlabel;
|
||||
__u32 tclass;
|
||||
diff -Nru iputils-orig/tracepath6.c iputils/tracepath6.c
|
||||
--- iputils-orig/tracepath6.c 2005-12-05 18:06:39.000000000 +0100
|
||||
+++ iputils/tracepath6.c 2005-12-05 18:06:55.000000000 +0100
|
||||
@@ -25,6 +25,19 @@
|
||||
#include <sys/uio.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
+/* Begin hack KERNEL >= 2.6.1x.x */
|
||||
+#define IPV6_ADDRFORM 1
|
||||
+#define IPV6_PKTINFO 2
|
||||
+#define IPV6_HOPOPTS 3
|
||||
+#define IPV6_DSTOPTS 4
|
||||
+#define IPV6_RTHDR 5
|
||||
+#define IPV6_PKTOPTIONS 6
|
||||
+#define IPV6_CHECKSUM 7
|
||||
+#define IPV6_HOPLIMIT 8
|
||||
+#define IPV6_NEXTHOP 9
|
||||
+#define IPV6_FLOWINFO 11
|
||||
+/* End hack */
|
||||
+
|
||||
int overhead = 48;
|
||||
int mtu = 128000;
|
||||
int hops_to = -1;
|
@ -1,16 +0,0 @@
|
||||
--- ping_common.c 2006-12-01 12:58:33.000000000 +0100
|
||||
+++ ping_common.c 2006-12-01 12:59:59.000000000 +0100
|
||||
@@ -187,6 +187,13 @@
|
||||
fprintf(stderr, "ping: illegal negative packet size %d.\n", datalen);
|
||||
exit(2);
|
||||
}
|
||||
+ if (datalen > 0xFFFF - 8 ) {
|
||||
+ if (uid || datalen > 0xFFFF ) {
|
||||
+ fprintf(stderr, "Error: packet size %d is too large. Maximim is %d\n", datalen, 0xFFFF - 8);
|
||||
+ exit(2);
|
||||
+ }
|
||||
+ fprintf(stderr, "WARNING: packet size %d is too large. Maximim is %d\n", datalen, 0xFFFF - 8 );
|
||||
+ }
|
||||
break;
|
||||
case 'v':
|
||||
options |= F_VERBOSE;
|
@ -1,44 +0,0 @@
|
||||
--- iputils/rdisc.c
|
||||
+++ iputils/rdisc.c
|
||||
@@ -63,6 +63,8 @@
|
||||
|
||||
#include "SNAPSHOT.h"
|
||||
|
||||
+#define RDISC_SERVER
|
||||
+
|
||||
struct interface
|
||||
{
|
||||
struct in_addr address; /* Used to identify the interface */
|
||||
@@ -163,11 +165,8 @@
|
||||
int debugfile;
|
||||
|
||||
char usage[] =
|
||||
-"Usage: rdisc [-b] [-d] [-s] [-v] [-f] [-a] [-V] [send_address] [receive_address]\n"
|
||||
-#ifdef RDISC_SERVER
|
||||
-" rdisc -r [-b] [-d] [-s] [-v] [-f] [-a] [-V] [-p <preference>] [-T <secs>] \n"
|
||||
-" [send_address] [receive_address]\n"
|
||||
-#endif
|
||||
+"Usage: rdisc -r [-b] [-d] [-s] [-v] [-f] [-a] [-V] [-p <preference>] [-T <secs>] \n"
|
||||
+" [send_address] [receive_address]\n"
|
||||
;
|
||||
|
||||
|
||||
@@ -875,7 +874,9 @@
|
||||
((max_adv_int - min_adv_int)
|
||||
* (random() % 1000)/1000);
|
||||
} else {
|
||||
- if (!is_directly_connected(ip->saddr)) {
|
||||
+ struct in_addr tmp;
|
||||
+ tmp.s_addr = ip->saddr;
|
||||
+ if (!is_directly_connected(tmp)) {
|
||||
if (verbose)
|
||||
logtrace("ICMP %s from %s: source not directly connected\n",
|
||||
pr_type((int)icp->type),
|
||||
@@ -945,7 +946,6 @@
|
||||
{
|
||||
#ifdef RDISC_SERVER
|
||||
if (responder) {
|
||||
- int i;
|
||||
|
||||
/* Send out a packet with a preference so that all
|
||||
* hosts will know that we are dead.
|
@ -1,15 +0,0 @@
|
||||
--- iputils/ping.c
|
||||
+++ iputils/ping.c
|
||||
@@ -125,7 +125,11 @@
|
||||
socket_errno = errno;
|
||||
|
||||
uid = getuid();
|
||||
- setuid(uid);
|
||||
+ if(setuid(uid) != 0)
|
||||
+ {
|
||||
+ perror("ping: setuid()");
|
||||
+ exit(-1);
|
||||
+ }
|
||||
|
||||
source.sin_family = AF_INET;
|
||||
|
@ -1,15 +0,0 @@
|
||||
--- iputils/ping6.c
|
||||
+++ iputils/ping6.c
|
||||
@@ -187,7 +187,11 @@
|
||||
socket_errno = errno;
|
||||
|
||||
uid = getuid();
|
||||
- setuid(uid);
|
||||
+ if(setuid(uid) != 0)
|
||||
+ {
|
||||
+ perror("ping: setuid()");
|
||||
+ exit(-1);
|
||||
+ }
|
||||
|
||||
source.sin6_family = AF_INET6;
|
||||
memset(&firsthop, 0, sizeof(firsthop));
|
@ -1,16 +0,0 @@
|
||||
--- iputils/traceroute6.c
|
||||
+++ iputils/traceroute6.c
|
||||
@@ -337,8 +337,11 @@
|
||||
icmp_sock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
|
||||
socket_errno = errno;
|
||||
|
||||
- setuid(getuid());
|
||||
-
|
||||
+ if(setuid(getuid()) != 0)
|
||||
+ {
|
||||
+ Fprintf(stderr, "traceroute: setuid()\n");
|
||||
+ exit(-1);
|
||||
+ }
|
||||
on = 1;
|
||||
seq = tos = 0;
|
||||
to = (struct sockaddr_in6 *)&whereto;
|
@ -1,11 +0,0 @@
|
||||
--- traceroute6.c 2007-03-06 09:02:55.000000000 +0100
|
||||
+++ traceroute6.c 2007-03-06 09:09:48.000000000 +0100
|
||||
@@ -717,7 +717,7 @@
|
||||
|
||||
if (t >= 128 && t <= 132)
|
||||
{
|
||||
- return (ttab2[t]);
|
||||
+ return (ttab2[t-128]);
|
||||
}
|
||||
|
||||
return("OUT-OF-RANGE");
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:06ea9c83b5ff1ed02f526ed798a59e949793da1c232457077e75fcc8a10cdcb4
|
||||
size 428335
|
@ -1,184 +0,0 @@
|
||||
---
|
||||
include-glibc/netinet/ip.h | 4
|
||||
ping.c | 13
|
||||
ping_common.c | 21 -
|
||||
ping_common.h | 10
|
||||
tracepath.c | 8
|
||||
tracepath6.c | 2
|
||||
7 files changed, 795 insertions(+), 33 deletions(-)
|
||||
|
||||
Index: iputils/include-glibc/netinet/ip.h
|
||||
===================================================================
|
||||
--- iputils.orig/include-glibc/netinet/ip.h
|
||||
+++ iputils/include-glibc/netinet/ip.h
|
||||
@@ -6,6 +6,10 @@
|
||||
|
||||
#include <linux/ip.h>
|
||||
|
||||
+/* From glibc, most of the time it is a bad idea to copy not complete
|
||||
+ header files */
|
||||
+#define IP_MAXPACKET 65535 /* maximum packet size */
|
||||
+
|
||||
#ifdef __USE_BSD
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
Index: iputils/ping.c
|
||||
===================================================================
|
||||
--- iputils.orig/ping.c
|
||||
+++ iputils/ping.c
|
||||
@@ -389,8 +389,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
hold = 1;
|
||||
- if (setsockopt(icmp_sock, SOL_IP, IP_RECVERR, (char *)&hold, sizeof(hold)))
|
||||
- fprintf(stderr, "WARNING: your kernel is veeery old. No problems.\n");
|
||||
+ setsockopt(icmp_sock, SOL_IP, IP_RECVERR, (char *)&hold, sizeof(hold));
|
||||
|
||||
/* record route option */
|
||||
if (options & F_RROUTE) {
|
||||
@@ -750,16 +749,6 @@ parse_reply(struct msghdr *msg, int cc,
|
||||
acknowledge(ntohs(icp1->un.echo.sequence));
|
||||
if (working_recverr) {
|
||||
return 0;
|
||||
- } else {
|
||||
- static int once;
|
||||
- /* Sigh, IP_RECVERR for raw socket
|
||||
- * was broken until 2.4.9. So, we ignore
|
||||
- * the first error and warn on the second.
|
||||
- */
|
||||
- if (once++ == 1)
|
||||
- fprintf(stderr, "\rWARNING: kernel is not very fresh, upgrade is recommended.\n");
|
||||
- if (once == 1)
|
||||
- return 0;
|
||||
}
|
||||
}
|
||||
nerrors+=error_pkt;
|
||||
Index: iputils/ping_common.c
|
||||
===================================================================
|
||||
--- iputils.orig/ping_common.c
|
||||
+++ iputils/ping_common.c
|
||||
@@ -39,16 +39,16 @@ int confirm_flag = MSG_CONFIRM;
|
||||
int working_recverr;
|
||||
|
||||
/* timing */
|
||||
-int timing; /* flag to do timing */
|
||||
-long tmin = LONG_MAX; /* minimum round trip time */
|
||||
-long tmax; /* maximum round trip time */
|
||||
+unsigned long long timing; /* flag to do timing */
|
||||
+unsigned long long tmin = LONG_MAX; /* minimum round trip time */
|
||||
+unsigned long long tmax; /* maximum round trip time */
|
||||
/* Message for rpm maintainers: have _shame_. If you want
|
||||
* to fix something send the patch to me for sanity checking.
|
||||
* "sparcfix" patch is a complete non-sense, apparenly the person
|
||||
* prepared it was stoned.
|
||||
*/
|
||||
-long long tsum; /* sum of all times, for doing average */
|
||||
-long long tsum2;
|
||||
+unsigned long long tsum; /* sum of all times, for doing average */
|
||||
+unsigned long long tsum2;
|
||||
int pipesize = -1;
|
||||
|
||||
int datalen = DEFDATALEN;
|
||||
@@ -662,7 +662,6 @@ restamp:
|
||||
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);
|
||||
triptime = 0;
|
||||
if (!(options & F_LATENCY)) {
|
||||
gettimeofday(tv, NULL);
|
||||
@@ -809,10 +808,10 @@ void finish(void)
|
||||
tmdev = llsqrt(tsum2 - tsum * tsum);
|
||||
|
||||
printf("rtt min/avg/max/mdev = %ld.%03ld/%lu.%03ld/%ld.%03ld/%ld.%03ld ms",
|
||||
- tmin/1000, tmin%1000,
|
||||
+ (long)tmin/1000, (long)tmin%1000,
|
||||
(unsigned long)(tsum/1000), (long)(tsum%1000),
|
||||
- tmax/1000, tmax%1000,
|
||||
- tmdev/1000, tmdev%1000
|
||||
+ (long)tmax/1000, (long)tmax%1000,
|
||||
+ (long)tmdev/1000, (long)tmdev%1000
|
||||
);
|
||||
}
|
||||
if (pipesize > 1)
|
||||
@@ -843,10 +842,10 @@ void status(void)
|
||||
tavg = tsum / (nreceived + nrepeats);
|
||||
|
||||
fprintf(stderr, ", min/avg/ewma/max = %ld.%03ld/%lu.%03ld/%d.%03d/%ld.%03ld ms",
|
||||
- tmin/1000, tmin%1000,
|
||||
+ (long)tmin/1000, (long)tmin%1000,
|
||||
tavg/1000, tavg%1000,
|
||||
rtt/8000, (rtt/8)%1000,
|
||||
- tmax/1000, tmax%1000
|
||||
+ (long)tmax/1000, (long)tmax%1000
|
||||
);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
Index: iputils/ping_common.h
|
||||
===================================================================
|
||||
--- iputils.orig/ping_common.h
|
||||
+++ iputils/ping_common.h
|
||||
@@ -103,11 +103,11 @@ extern int working_recverr;
|
||||
|
||||
|
||||
/* timing */
|
||||
-extern int timing; /* flag to do timing */
|
||||
-extern long tmin; /* minimum round trip time */
|
||||
-extern long tmax; /* maximum round trip time */
|
||||
-extern long long tsum; /* sum of all times, for doing average */
|
||||
-extern long long tsum2;
|
||||
+extern unsigned long long timing; /* flag to do timing */
|
||||
+extern unsigned long long tmin; /* minimum round trip time */
|
||||
+extern unsigned long long tmax; /* maximum round trip time */
|
||||
+extern unsigned long long tsum; /* sum of all times, for doing average */
|
||||
+extern unsigned long long tsum2;
|
||||
extern int rtt;
|
||||
extern __u16 acked;
|
||||
extern int pipesize;
|
||||
Index: iputils/tracepath.c
|
||||
===================================================================
|
||||
--- iputils.orig/tracepath.c
|
||||
+++ iputils/tracepath.c
|
||||
@@ -75,7 +75,7 @@ int recverr(int fd, int ttl)
|
||||
int sndhops;
|
||||
int progress = -1;
|
||||
int broken_router;
|
||||
-
|
||||
+
|
||||
restart:
|
||||
memset(&rcvbuf, -1, sizeof(rcvbuf));
|
||||
iov.iov_base = &rcvbuf;
|
||||
@@ -124,8 +124,8 @@ restart:
|
||||
e = (struct sock_extended_err *) CMSG_DATA(cmsg);
|
||||
} else if (cmsg->cmsg_type == IP_TTL) {
|
||||
rethops = *(int*)CMSG_DATA(cmsg);
|
||||
- } else {
|
||||
- printf("cmsg:%d\n ", cmsg->cmsg_type);
|
||||
+ } else {
|
||||
+ printf("cmsg:%d\n ", cmsg->cmsg_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -330,7 +330,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
for (ttl=1; ttl<32; ttl++) {
|
||||
- int res;
|
||||
+ int res = 0;
|
||||
int i;
|
||||
|
||||
on = ttl;
|
||||
Index: iputils/tracepath6.c
|
||||
===================================================================
|
||||
--- iputils.orig/tracepath6.c
|
||||
+++ iputils/tracepath6.c
|
||||
@@ -364,7 +364,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
for (ttl=1; ttl<32; ttl++) {
|
||||
- int res;
|
||||
+ int res = 0;
|
||||
int i;
|
||||
|
||||
on = ttl;
|
||||
|
@ -1,3 +1,25 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jul 14 13:42:08 CEST 2010 - ms@suse.de
|
||||
|
||||
- fixed device broadcast setup (bnc #614389)
|
||||
- upstream maintainer has changed. new maintainer is
|
||||
YOSHIFUJI Hideaki. Along with this change the versioning
|
||||
of the package also changed. Current version is: s20100418
|
||||
from 18-Apr-2010
|
||||
- many patches upstream now, reduced patch set
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jul 13 17:03:24 CEST 2010 - ms@suse.de
|
||||
|
||||
- reverted arping-infiniband.diff, it breaks arping
|
||||
(bnc #614389) and (bnc #610839)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Jul 8 16:24:50 CEST 2010 - ms@suse.de
|
||||
|
||||
- security fix: replies by a malicious system can
|
||||
make ping run into an endless loop (bnc #620837)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jun 4 09:22:08 CEST 2010 - ms@suse.de
|
||||
|
||||
|
67
iputils.spec
67
iputils.spec
@ -1,5 +1,5 @@
|
||||
#
|
||||
# spec file for package iputils (Version ss021109)
|
||||
# spec file for package iputils (Version s20100418)
|
||||
#
|
||||
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
#
|
||||
@ -19,37 +19,22 @@
|
||||
|
||||
|
||||
Name: iputils
|
||||
BuildRequires: sysfsutils
|
||||
BuildRequires: docbook_3 iso_ent libopenssl-devel opensp perl-SGMLS sysfsutils
|
||||
Summary: IPv4and IPv6 Networking Utilities
|
||||
Version: ss021109
|
||||
Release: 295
|
||||
Version: s20100418
|
||||
Release: 1
|
||||
License: BSD3c ; GPLv2+
|
||||
Group: Productivity/Networking/Other
|
||||
Provides: nkitb
|
||||
Obsoletes: nkitb
|
||||
Url: ftp://ftp.tux.org/people/alexey-kuznetsov/ip-routing
|
||||
Source: iputils-%{version}-try.tar.bz2
|
||||
Source1: iputils-ifenslave-1.1.0.tar.bz2
|
||||
Patch: %name-%version.diff
|
||||
Patch1: %name-%version-rdisc-server.patch
|
||||
Patch2: %name-%version-sec-traceroute6-setuid-retvalcheck.diff
|
||||
Patch3: %name-%version-sec-ping6-setuid-retvalcheck.diff
|
||||
Patch4: %name-%version-sec-ping-setuid-retvalcheck.diff
|
||||
Patch5: %name-%version-ping-R-option-doc.diff
|
||||
Patch6: %name-headers.patch
|
||||
Patch7: %name-%version-pingnamelookuponce.diff
|
||||
Patch8: %name-ss021109-traceroute6-stdint.diff
|
||||
Patch9: %name-ADDLIB.diff
|
||||
Patch10: %name-ss021109-locallinksyntax.diff
|
||||
Patch11: iputils-ss021109-ping6kernel261x.diff
|
||||
Patch12: %name-ifenslave.patch
|
||||
Patch13: %name-HZ.patch
|
||||
Patch14: %name-%version-ping6_getaddrinfo.patch
|
||||
Patch15: %name-%version-ping_common.dif
|
||||
Patch16: %name-ss021109-traceroute6-ttab.diff
|
||||
Patch17: %name-%version-open_max.diff
|
||||
Patch18: %name-%version-ping-interrupt.diff
|
||||
Patch19: %name-%version-arping-infiniband.diff
|
||||
Url: http://www.skbuff.net/iputils
|
||||
Source: iputils.tar.bz2
|
||||
Source1: iputils-ifenslave.tar.bz2
|
||||
Patch1: %name-pingnamelookuponce.diff
|
||||
Patch2: %name-traceroute6-stdint.diff
|
||||
Patch3: %name-ifenslave.diff
|
||||
Patch4: %name-arping-set_device_broadcast.diff
|
||||
Patch5: %name-ADDLIB.diff
|
||||
Prefix: %_prefix
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
||||
@ -62,29 +47,15 @@ rdisc, ping6, traceroute6, tracepath, and tracepath6.
|
||||
Authors:
|
||||
--------
|
||||
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
|
||||
YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
|
||||
|
||||
%prep
|
||||
%setup -q -n %name -b1
|
||||
%patch -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6
|
||||
%patch7 -p1
|
||||
%patch8
|
||||
%patch9
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12
|
||||
%patch13
|
||||
%patch14
|
||||
%patch15
|
||||
%patch16
|
||||
%patch17 -p1
|
||||
%patch18
|
||||
%patch19
|
||||
%patch1
|
||||
%patch2
|
||||
%patch3
|
||||
%patch4
|
||||
%patch5
|
||||
mkdir linux
|
||||
touch linux/autoconf.h
|
||||
|
||||
@ -92,6 +63,8 @@ touch linux/autoconf.h
|
||||
make %{?_smp_mflags} KERNEL_INCLUDE=$PWD DEFINES='%optflags -fpie' ADDLIB='-pie'
|
||||
gcc $RPM_OPT_FLAGS -o ifenslave ifenslave.c
|
||||
|
||||
make man
|
||||
|
||||
%install
|
||||
mkdir -p $RPM_BUILD_ROOT%_sbindir
|
||||
mkdir -p $RPM_BUILD_ROOT/{bin,sbin}
|
||||
|
3
iputils.tar.bz2
Normal file
3
iputils.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:183d4f767dab69dc7cf3782e0ded63cc5066bfc102a981ec4766334ff33d0ae1
|
||||
size 115376
|
Loading…
Reference in New Issue
Block a user