iputils/iputils-ss021109.diff
OBS User autobuild 4809e4513d Accepting request 38628 from network:utilities
Copy from network:utilities/iputils based on submit request 38628 from user sax2

OBS-URL: https://build.opensuse.org/request/show/38628
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/iputils?expand=0&rev=9
2010-04-25 16:41:34 +00:00

185 lines
5.7 KiB
Diff

---
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;