1 --- iputils/ping_common.c.old Thu Mar 14 16:58:47 2002
2 +++ iputils/ping_common.c Thu Mar 14 17:10:54 2002
4 tmdev = llsqrt(tsum2 - tsum * tsum);
6 printf("rtt min/avg/max/mdev = %ld.%03ld/%lu.%03ld/%ld.%03ld/%ld.%03ld ms",
7 - tmin/1000, tmin%1000,
8 + (long)tmin/1000, (long)tmin%1000,
9 (unsigned long)(tsum/1000), (long)(tsum%1000),
10 - tmax/1000, tmax%1000,
11 - tmdev/1000, tmdev%1000
12 + (long)tmax/1000, (long)tmax%1000,
13 + (long)tmdev/1000, (long)tmdev%1000
18 tavg = tsum / (nreceived + nrepeats);
20 fprintf(stderr, ", min/avg/ewma/max = %ld.%03ld/%lu.%03ld/%d.%03d/%ld.%03ld ms",
21 - tmin/1000, tmin%1000,
22 + (long)tmin/1000, (long)tmin%1000,
24 rtt/8000, (rtt/8)%1000,
25 - tmax/1000, tmax%1000
26 + (long)tmax/1000, (long)tmax%1000
29 fprintf(stderr, "\n");
30 --- iputils/rdisc.c-org Wed May 1 00:27:34 2002
31 +++ iputils/rdisc.c Wed May 1 00:32:40 2002
40 struct in_addr address; /* Used to identify the interface */
45 -"Usage: rdisc [-b] [-d] [-s] [-v] [-f] [-a] [-V] [send_address] [receive_address]\n"
47 -" rdisc -r [-b] [-d] [-s] [-v] [-f] [-a] [-V] [-p <preference>] [-T <secs>] \n"
48 -" [send_address] [receive_address]\n"
50 +"Usage: rdisc -r [-b] [-d] [-s] [-v] [-f] [-a] [-V] [-p <preference>] [-T <secs>] \n"
51 +" [send_address] [receive_address]\n"
56 ((max_adv_int - min_adv_int)
57 * (random() % 1000)/1000);
59 - if (!is_directly_connected(ip->saddr)) {
61 + tmp.s_addr = ip->saddr;
62 + if (!is_directly_connected(tmp)) {
64 logtrace("ICMP %s from %s: source not directly connected\n",
65 pr_type((int)icp->type),
72 /* Send out a packet with a preference so that all
73 * hosts will know that we are dead.
74 --- iputils/ping_common.c.countermeasures Tue May 21 10:06:05 2002
75 +++ iputils/ping_common.c Tue May 21 10:12:42 2002
78 triptime = tv->tv_sec * 1000000 + tv->tv_usec;
80 - fprintf(stderr, "Warning: time of day goes back (%ldus), taking countermeasures.\n", triptime);
81 + if (options & F_VERBOSE)
82 + fprintf(stderr, "Warning: time of day goes back (%ldus), taking countermeasures.\n", triptime);
84 if (!(options & F_LATENCY)) {
85 gettimeofday(tv, NULL);
86 --- iputils/ping.c.addrcache 2002-09-20 17:08:11.000000000 +0200
87 +++ iputils/ping.c 2003-05-15 16:41:19.000000000 +0200
88 @@ -1124,6 +1124,12 @@
91 static char buf[4096];
92 + static __u32 addr_cache = 0;
94 + if ( addr == addr_cache )
99 if ((options & F_NUMERIC) ||
100 !(hp = gethostbyaddr((char *)&addr, 4, AF_INET)))
101 --- iputils/ping6.c.addrcache 2002-09-20 17:08:11.000000000 +0200
102 +++ iputils/ping6.c 2003-05-15 16:41:19.000000000 +0200
105 char * pr_addr(struct in6_addr *addr)
107 - struct hostent *hp = NULL;
108 + static struct hostent *hp = NULL;
109 + static struct in6_addr addr_cache = {{{0,0,0,0}}};
111 + if ( addr->s6_addr32[0] == addr_cache.s6_addr32[0] &&
112 + addr->s6_addr32[1] == addr_cache.s6_addr32[1] &&
113 + addr->s6_addr32[2] == addr_cache.s6_addr32[2] &&
114 + addr->s6_addr32[3] == addr_cache.s6_addr32[3] )
115 + return hp ? hp->h_name : pr_addr_n(addr);
117 if (!(options&F_NUMERIC))
118 hp = gethostbyaddr((__u8*)addr, sizeof(struct in6_addr), AF_INET6);
119 --- iputils-ss021109-vanilla/ping.c Thu Nov 7 23:53:21 2002
120 +++ iputils/ping.c Sun Jan 12 03:39:24 2003
122 perror("ping: IP_MULTICAST_IF");
125 + } else if (icmp_sock >= 0) {
126 + /* We possible tried to SO_BINDTODEVICE() a subinterface like 'eth0:1' */
127 + perror("Warning: cannot bind to specified iface, falling back");
131 --- iputils/ping.c.icmp_seq 2003-09-03 16:45:07.000000000 +0200
132 +++ iputils/ping.c 2003-09-03 16:45:41.000000000 +0200
134 icp->type = ICMP_ECHO;
137 - icp->un.echo.sequence = htons(ntransmitted+1);
138 + icp->un.echo.sequence = htons(ntransmitted);
139 icp->un.echo.id = ident; /* ID */
141 CLR((ntransmitted+1) % mx_dup_ck);
142 --- iputils/ping6.c.icmp_seq 2003-09-03 16:45:20.000000000 +0200
143 +++ iputils/ping6.c 2003-09-03 16:45:34.000000000 +0200
145 icmph->icmp6_type = ICMPV6_ECHO_REQUEST;
146 icmph->icmp6_code = 0;
147 icmph->icmp6_cksum = 0;
148 - icmph->icmp6_sequence = htons(ntransmitted+1);
149 + icmph->icmp6_sequence = htons(ntransmitted);
150 icmph->icmp6_identifier = ident;
152 CLR((ntransmitted+1) % mx_dup_ck);
153 diff -ru iputils/include-glibc/netinet/in.h iputils-clean/include-glibc/netinet/in.h
154 --- iputils/include-glibc/netinet/in.h 2000-06-18 14:57:25.000000000 -0400
155 +++ iputils-clean/include-glibc/netinet/in.h 2003-09-03 11:21:55.000000000 -0400
160 -#endif /* netinet/in.h */
161 +/* Functions to convert between host and network byte order.
163 + Please note that these functions normally take `unsigned long int' or
164 + `unsigned short int' values as arguments and also return them. But
165 + this was a short-sighted decision since on different systems the types
166 + may have different representations but the values are always the same. */
168 +extern u_int32_t ntohl (u_int32_t __netlong) __THROW __attribute__ ((__const__));
169 +extern u_int16_t ntohs (u_int16_t __netshort)
170 + __THROW __attribute__ ((__const__));
171 +extern u_int32_t htonl (u_int32_t __hostlong)
172 + __THROW __attribute__ ((__const__));
173 +extern u_int16_t htons (u_int16_t __hostshort)
174 + __THROW __attribute__ ((__const__));
178 +/* Get machine dependent optimized versions of byte swapping functions. */
179 +#include <bits/byteswap.h>
182 +/* We can optimize calls to the conversion functions. Either nothing has
183 + to be done or we are using directly the byte-swapping functions which
184 + often can be inlined. */
185 +# if __BYTE_ORDER == __BIG_ENDIAN
186 +/* The host byte order is the same as network byte order,
187 + so these functions are all just identity. */
188 +# define ntohl(x) (x)
189 +# define ntohs(x) (x)
190 +# define htonl(x) (x)
191 +# define htons(x) (x)
193 +# if __BYTE_ORDER == __LITTLE_ENDIAN
194 +# define ntohl(x) __bswap_32 (x)
195 +# define ntohs(x) __bswap_16 (x)
196 +# define htonl(x) __bswap_32 (x)
197 +# define htons(x) __bswap_16 (x)
202 +#endif /* netinet/in.h */
203 diff -ru iputils/ping6.c iputils-clean/ping6.c
204 --- iputils/ping6.c 2003-09-03 11:22:46.000000000 -0400
205 +++ iputils-clean/ping6.c 2003-09-03 11:15:42.000000000 -0400
209 /* Patch bpflet for current identifier. */
210 - insns[1] = (struct sock_filter)BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __constant_htons(ident), 0, 1);
211 + insns[1] = (struct sock_filter)BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, htons(ident), 0, 1);
213 if (setsockopt(icmp_sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)))
214 perror("WARNING: failed to install socket filter\n");
215 diff -ru iputils/ping.c iputils-clean/ping.c
216 --- iputils/ping.c 2003-09-03 11:22:46.000000000 -0400
217 +++ iputils-clean/ping.c 2003-09-03 11:15:26.000000000 -0400
218 @@ -1196,7 +1196,7 @@
221 /* Patch bpflet for current identifier. */
222 - insns[2] = (struct sock_filter)BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __constant_htons(ident), 0, 1);
223 + insns[2] = (struct sock_filter)BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, htons(ident), 0, 1);
225 if (setsockopt(icmp_sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)))
226 perror("WARNING: failed to install socket filter\n");
227 diff -urN iputils/clockdiff.c iputils.new/clockdiff.c
228 --- iputils/clockdiff.c 2002-02-22 19:10:59.000000000 -0500
229 +++ iputils.new/clockdiff.c 2003-09-10 09:20:28.000000000 -0400
231 #include <sys/types.h>
232 #include <sys/param.h>
234 +#include <linux/types.h>
238 diff -urN iputils/ping6.c iputils.new/ping6.c
239 --- iputils/ping6.c 2003-09-10 17:27:48.000000000 -0400
240 +++ iputils.new/ping6.c 2003-09-10 17:22:43.000000000 -0400
243 #include "ping_common.h"
245 -#include <linux/in6.h>
246 -#include <linux/ipv6.h>
247 +struct ipv6_rt_hdr {
251 + __u8 segments_left;
254 + * type specific data
255 + * variable length field
260 + struct ipv6_rt_hdr rt_hdr;
261 + __u32 bitmap; /* strict/loose bit map */
262 + struct in6_addr addr[0];
264 +#define rt0_type rt_hdr.type;
266 +#define IPV6_SRCRT_TYPE_0 0 /* IPv6 type 0 Routing Header */
268 +#if defined(__LITTLE_ENDIAN)
271 +#elif defined(__BIG_ENDIAN)
281 + struct in6_addr saddr;
282 + struct in6_addr daddr;
285 #include <linux/icmpv6.h>
287 #define BIT_CLEAR(nr, addr) do { ((__u32 *)(addr))[(nr) >> 5] &= ~(1U << ((nr) & 31)); } while(0)
288 diff -urN iputils/ping_common.h iputils.new/ping_common.h
289 --- iputils/ping_common.h 2002-09-20 11:08:11.000000000 -0400
290 +++ iputils.new/ping_common.h 2003-09-10 17:16:16.000000000 -0400
293 #include <netinet/in.h>
294 #include <arpa/inet.h>
295 +#include <linux/types.h>
296 #include <linux/errqueue.h>
298 #include "SNAPSHOT.h"
299 diff -urN iputils/tftpd.c iputils.new/tftpd.c
300 --- iputils/tftpd.c 2002-01-23 19:31:41.000000000 -0500
301 +++ iputils.new/tftpd.c 2003-09-10 09:39:45.000000000 -0400
304 #include <sys/socket.h>
305 #include <netinet/in.h>
306 -#include <linux/in6.h>
310 diff -urN iputils/tracepath6.c iputils.new/tracepath6.c
311 --- iputils/tracepath6.c 2001-09-01 22:03:46.000000000 -0400
312 +++ iputils.new/tracepath6.c 2003-09-10 09:40:18.000000000 -0400
315 #include <sys/socket.h>
316 #include <netinet/in.h>
318 -#include <linux/in6.h>
319 +#include <linux/types.h>
320 #include <linux/errqueue.h>
323 diff -urN iputils/tracepath.c iputils.new/tracepath.c
324 --- iputils/tracepath.c 2002-02-22 19:10:59.000000000 -0500
325 +++ iputils.new/tracepath.c 2003-09-10 06:14:35.000000000 -0400
329 #include <sys/socket.h>
330 +#include <linux/types.h>
331 #include <linux/errqueue.h>
334 diff -urN iputils/traceroute6.c iputils.new/traceroute6.c
335 --- iputils/traceroute6.c 2002-09-20 11:44:22.000000000 -0400
336 +++ iputils.new/traceroute6.c 2003-09-10 10:12:47.000000000 -0400
338 #include <netinet/ip_icmp.h>
339 #include <netinet/udp.h>
341 -#include <linux/ipv6.h>
342 -#include <linux/in6.h>
343 +#include <linux/types.h>
345 +#if defined(__LITTLE_ENDIAN)
348 +#elif defined(__BIG_ENDIAN)
358 + struct in6_addr saddr;
359 + struct in6_addr daddr;
361 #include <linux/icmpv6.h>
363 #include <arpa/inet.h>
364 --- iputils/arping.c.unaligned 2001-10-06 00:42:47.000000000 +0200
365 +++ iputils/arping.c 2003-10-02 15:14:42.000000000 +0200
367 timeout = atoi(optarg);
371 + device = strdup(optarg);
375 --- iputils/traceroute6.c.inet_pton 2004-04-22 15:06:28.268797480 +0200
376 +++ iputils/traceroute6.c 2004-04-22 15:06:35.727877941 +0200
379 (void) bzero((char *)&saddr, sizeof(saddr));
380 saddr.sin6_family = AF_INET6;
381 - if (inet_pton(AF_INET6, source, &saddr.sin6_addr) < 0)
382 + if (inet_pton(AF_INET6, source, &saddr.sin6_addr) <= 0)
384 Printf("traceroute: unknown addr %s\n", source);
386 --- iputils/traceroute6.c.old 2004-12-07 11:08:57.000000000 +0100
387 +++ iputils/traceroute6.c 2004-12-07 11:14:09.397575536 +0100
389 icmp_sock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
390 socket_errno = errno;
394 + if(setuid(getuid()) != 0)
396 + perror("traceroute: setuid()");
401 to = (struct sockaddr_in6 *)&whereto;
402 --- iputils/ping6.c.old 2004-12-07 11:08:57.000000000 +0100
403 +++ iputils/ping6.c 2004-12-07 11:13:40.707937024 +0100
405 socket_errno = errno;
409 + if(setuid(uid) != 0)
411 + perror("ping: setuid()");
415 source.sin6_family = AF_INET6;
416 memset(&firsthop, 0, sizeof(firsthop));
417 --- iputils/ping.c.old 2004-12-07 11:08:57.000000000 +0100
418 +++ iputils/ping.c 2004-12-07 11:13:27.523941296 +0100
420 socket_errno = errno;
424 + if(setuid(uid) != 0)
426 + perror("ping: setuid()");
430 source.sin_family = AF_INET;
432 --- iputils/doc/ping.8.old 2002-09-27 19:12:47.000000000 +0200
433 +++ iputils/doc/ping.8 2004-12-07 11:09:42.434160144 +0100
439 +Record route. (IPv4 only)
440 Includes the RECORD_ROUTE option in the ECHO_REQUEST
441 packet and displays the route buffer on returned packets.
442 Note that the IP header is only large enough for nine such routes.
443 --- iputils/doc/ping.sgml.old 2002-09-20 14:55:50.000000000 +0200
444 +++ iputils/doc/ping.sgml 2004-12-07 11:09:42.435159992 +0100
447 <term><option/-R/</term>
450 +Record route. (IPv4 only)
451 Includes the RECORD_ROUTE option in the ECHO_REQUEST
452 packet and displays the route buffer on returned packets.
453 Note that the IP header is only large enough for nine such routes.
454 --- iputils/ping.c 2005-05-18 01:37:05.621810488 -0400
455 +++ iputils/ping.c.new 2005-05-18 01:41:27.113018222 -0400
456 @@ -101,7 +101,7 @@ static struct {
459 struct sockaddr_in source;
465 @@ -177,7 +177,7 @@ main(int argc, char **argv)
467 options |= F_STRICTSOURCE;
470 + device = strdup(optarg);
474 --- iputils/ping6.c 2005-05-18 01:37:05.620833925 -0400
475 +++ iputils/ping6.c.new 2005-05-18 01:41:23.599346390 -0400
476 @@ -155,7 +155,7 @@ static int pr_icmph(__u8 type, __u8 code
477 static void usage(void) __attribute((noreturn));
479 struct sockaddr_in6 source;
484 static int icmp_sock;
485 @@ -248,7 +248,7 @@ int main(int argc, char *argv[])
487 options |= F_STRICTSOURCE;
490 + device = strdup(optarg);
494 diff -ur iputils/arping.c iputils.tom/arping.c
495 --- iputils/arping.c 2005-07-15 13:51:15.533632784 -0700
496 +++ iputils.tom/arping.c 2005-07-15 13:50:47.967823000 -0700
498 #define MS_TDIFF(tv1,tv2) ( ((tv1).tv_sec-(tv2).tv_sec)*1000 + \
499 ((tv1).tv_usec-(tv2).tv_usec)/1000 )
501 +#define min(x,y) ((x)<(y) ? (x) : (y))
510 - memset(he.sll_addr, -1, he.sll_halen);
511 + memset(he.sll_addr, -1, min(he.sll_halen, sizeof he.sll_addr));
514 printf("ARPING %s ", inet_ntoa(dst));
515 --- iputils/arping.c.orig 2001-10-05 18:42:47.000000000 -0400
516 +++ iputils/arping.c 2005-07-13 13:07:45.406217716 -0400
517 @@ -166,10 +166,12 @@ void catcher(void)
521 - if (count-- == 0 || (timeout && MS_TDIFF(tv,start) > timeout*1000 + 500))
522 + if ((timeout && MS_TDIFF(tv,start) > timeout*1000 + 500) ||
523 + ((count == 0) && (!timeout)))
526 if (last.tv_sec==0 || MS_TDIFF(tv,last) > 500) {
528 send_pack(s, src, dst, &me, &he);
529 if (count == 0 && unsolicited)
531 @@ -510,6 +512,8 @@ main(int argc, char **argv)
532 sigaddset(&sset, SIGINT);
533 sigprocmask(SIG_BLOCK, &sset, &osset);
534 recv_pack(packet, cc, &from);
535 + if(received == count)
537 sigprocmask(SIG_SETMASK, &osset, NULL);
540 --- iputils/tracepath6.c.getaddrinfo 2005-09-08 10:31:47.000000000 +0200
541 +++ iputils/tracepath6.c 2005-09-08 10:31:47.000000000 +0200
543 struct sockaddr_in6 sin;
546 - struct hostent *he;
547 + struct addrinfo hints, *res;
550 while ((ch = getopt(argc, argv, "nbh?")) != EOF) {
551 @@ -308,20 +308,26 @@
555 - sin.sin6_family = AF_INET6;
557 p = strchr(argv[0], '/');
562 + memset(&hints, '\0', sizeof(hints));
563 + hints.ai_family = AF_INET6;
564 + if (getaddrinfo(argv[0], NULL, &hints, &res)) {
565 + herror("getaddrinfo");
569 + memcpy(&sin, res->ai_addr, sizeof(struct sockaddr_in6));
573 sin.sin6_port = htons(atoi(p+1));
575 sin.sin6_port = htons(0x8000 | getpid());
576 - he = gethostbyname2(argv[0], AF_INET6);
578 - herror("gethostbyname2");
581 - memcpy(&sin.sin6_addr, he->h_addr, 16);
583 if (connect(fd, (struct sockaddr*)&sin, sizeof(sin)) < 0) {
585 --- iputils/tracepath.c.getaddrinfo 2005-09-08 10:31:47.000000000 +0200
586 +++ iputils/tracepath.c 2005-09-08 11:03:39.000000000 +0200
587 @@ -272,12 +272,12 @@
589 main(int argc, char **argv)
591 - struct hostent *he;
597 + struct addrinfo hints, *res;
599 while ((ch = getopt(argc, argv, "nh?")) != EOF) {
601 @@ -300,20 +300,26 @@
605 - target.sin_family = AF_INET;
607 p = strchr(argv[0], '/');
612 + memset(&hints, '\0', sizeof(hints));
613 + hints.ai_family = AF_INET;
614 + if (getaddrinfo(argv[0], NULL, &hints, &res)) {
615 + herror("getaddrinfo");
619 + memcpy(&target, res->ai_addr, sizeof(struct sockaddr_in));
623 base_port = atoi(p+1);
627 - he = gethostbyname(argv[0]);
629 - herror("gethostbyname");
632 - memcpy(&target.sin_addr, he->h_addr, 4);
635 if (setsockopt(fd, SOL_IP, IP_MTU_DISCOVER, &on, sizeof(on))) {
636 --- iputils/ping.c.flood 2005-09-26 09:26:49.000000000 +0200
637 +++ iputils/ping.c 2005-09-26 13:07:39.000000000 +0200
639 icp->type = ICMP_ECHO;
642 - icp->un.echo.sequence = htons(ntransmitted);
643 + icp->un.echo.sequence = htons(ntransmitted+1);
644 icp->un.echo.id = ident; /* ID */
646 CLR((ntransmitted+1) % mx_dup_ck);
647 diff -ru iputils/ping_common.c iputils-foo/ping_common.c
648 --- iputils/ping_common.c 2005-09-22 15:22:57.000000000 -0400
649 +++ iputils-foo/ping_common.c 2005-09-22 15:24:42.000000000 -0400
651 * destined to other running pings. */
653 iov.iov_len = packlen;
654 + memset(&msg,'\0',sizeof(msg));
655 msg.msg_name = addrbuf;
656 msg.msg_namelen = sizeof(addrbuf);
658 --- iputils/tracepath6.c.hoplimit 2005-12-13 13:32:56.000000000 +0100
659 +++ iputils/tracepath6.c 2005-12-13 13:35:01.000000000 +0100
661 perror("IP_RECVERR");
664 - if (setsockopt(fd, SOL_IPV6, IPV6_HOPLIMIT, &on, sizeof(on))) {
665 - perror("IPV6_HOPLIMIT");
666 + if (setsockopt(fd, SOL_IPV6, IPV6_RECVHOPLIMIT, &on, sizeof(on))) {
667 + perror("IPV6_RECVHOPLIMIT");
670 if (mapped && setsockopt(fd, SOL_IP, IP_RECVTTL, &on, sizeof(on))) {
671 --- iputils/ping6.c.hoplimit 2005-12-13 13:32:56.000000000 +0100
672 +++ iputils/ping6.c 2005-12-13 13:34:04.000000000 +0100
673 @@ -521,13 +521,10 @@
679 - if (setsockopt(icmp_sock, IPPROTO_IPV6, IPV6_HOPLIMIT,
680 - &on, sizeof(on)) == -1) {
681 - perror ("can't receive hop limit");
685 + if (setsockopt(icmp_sock, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &on, sizeof(on))) {
686 + perror("setsockopt(IPV6_RECVHOPLIMIT)");
690 if (options&F_FLOWINFO) {
691 --- iputils/ping6.c.gcc41 2006-01-25 16:21:47.000000000 +0100
692 +++ iputils/ping6.c 2006-01-25 16:21:47.000000000 +0100
696 alen = sizeof(source);
697 - if (getsockname(probe_fd, (struct sockaddr*)&source, &alen) == -1) {
698 + if (getsockname(probe_fd, (struct sockaddr*)&source, (socklen_t*)&alen) == -1) {
699 perror("getsockname");
704 int local_errors = 0;
705 int saved_errno = errno;
708 iov.iov_base = &icmph;
709 iov.iov_len = sizeof(icmph);
711 if (options & F_QUIET)
713 if (options & F_FLOOD)
714 - write(STDOUT_FILENO, "E", 1);
715 + wr_ret = write(STDOUT_FILENO, "E", 1);
716 else if (e->ee_errno != EMSGSIZE)
717 fprintf(stderr, "ping: local error: %s\n", strerror(e->ee_errno));
720 if (options & F_QUIET)
722 if (options & F_FLOOD) {
723 - write(STDOUT_FILENO, "\bE", 2);
724 + wr_ret = write(STDOUT_FILENO, "\bE", 2);
726 printf("From %s icmp_seq=%u ", pr_addr(&sin6->sin6_addr), ntohs(icmph.icmp6_sequence));
727 pr_icmph(e->ee_type, e->ee_code, e->ee_info);
731 if (options & F_FLOOD) {
732 - write(STDOUT_FILENO, "\bE", 2);
734 + wr_ret = write(STDOUT_FILENO, "\bE", 2);
737 printf("From %s: icmp_seq=%u ", pr_addr(&from->sin6_addr), ntohs(icmph1->icmp6_sequence));
738 --- iputils/arping.c.gcc41 2006-01-25 16:21:47.000000000 +0100
739 +++ iputils/arping.c 2006-01-25 16:21:47.000000000 +0100
744 - if (getsockname(probe_fd, (struct sockaddr*)&saddr, &alen) == -1) {
745 + if (getsockname(probe_fd, (struct sockaddr*)&saddr, (socklen_t*)&alen) == -1) {
746 perror("getsockname");
752 int alen = sizeof(me);
753 - if (getsockname(s, (struct sockaddr*)&me, &alen) == -1) {
754 + if (getsockname(s, (struct sockaddr*)&me, (socklen_t*)&alen) == -1) {
755 perror("getsockname");
758 @@ -499,13 +499,13 @@
761 sigset_t sset, osset;
763 + unsigned char packet[4096];
764 struct sockaddr_ll from;
765 int alen = sizeof(from);
768 if ((cc = recvfrom(s, packet, sizeof(packet), 0,
769 - (struct sockaddr *)&from, &alen)) < 0) {
770 + (struct sockaddr *)&from, (socklen_t*)&alen)) < 0) {
771 perror("arping: recvfrom");
774 --- iputils/traceroute6.c.gcc41 2006-01-25 16:21:47.000000000 +0100
775 +++ iputils/traceroute6.c 2006-01-25 16:21:47.000000000 +0100
779 alen = sizeof(saddr);
780 - if (getsockname(probe_fd, (struct sockaddr*)&saddr, &alen) == -1) {
781 + if (getsockname(probe_fd, (struct sockaddr*)&saddr, (socklen_t*)&alen) == -1) {
782 perror("getsockname");
787 if (select(sock+1, &fds, (fd_set *)0, (fd_set *)0, &wait) > 0) {
788 cc=recvfrom(icmp_sock, (char *)packet, sizeof(packet), 0,
789 - (struct sockaddr *)from, &fromlen);
790 + (struct sockaddr *)from, (socklen_t*)&fromlen);
794 --- iputils/tftpd.c.gcc41 2006-01-25 16:21:47.000000000 +0100
795 +++ iputils/tftpd.c 2006-01-25 16:21:47.000000000 +0100
798 fromlen = sizeof (from);
799 n = recvfrom(0, buf, sizeof (buf), 0,
800 - (struct sockaddr *)&from, &fromlen);
801 + (struct sockaddr *)&from, (socklen_t*)&fromlen);
804 syslog(LOG_ERR, "recvfrom: %m\n");
806 * than one tftpd being started up to service
807 * a single request from a single client.
811 i = recvfrom(0, buf, sizeof (buf), 0,
812 - (struct sockaddr *)&from, &j);
813 + (struct sockaddr *)&from, (socklen_t*)&j);
817 --- iputils/clockdiff.c.gcc41 2006-01-25 16:21:47.000000000 +0100
818 +++ iputils/clockdiff.c 2006-01-25 16:21:47.000000000 +0100
820 if (select(FD_SETSIZE, &ready, (fd_set *)0, (fd_set *)0, &tout)) {
821 length = sizeof(struct sockaddr_in);
822 cc = recvfrom(sock_raw, (char *)packet, PACKET_IN, 0,
823 - (struct sockaddr *)NULL, &length);
824 + (struct sockaddr *)NULL, (socklen_t*)&length);
830 (void)gettimeofday(&tv1, (struct timezone *)0);
831 cc = recvfrom(sock_raw, (char *)packet, PACKET_IN, 0,
832 - (struct sockaddr *)NULL, &length);
833 + (struct sockaddr *)NULL, (socklen_t*)&length);
838 if (select(FD_SETSIZE, &ready, (fd_set *)0, (fd_set *)0, &tout)) {
839 length = sizeof(struct sockaddr_in);
840 cc = recvfrom(sock_raw, (char *)packet, PACKET_IN, 0,
841 - (struct sockaddr *)NULL, &length);
842 + (struct sockaddr *)NULL, (socklen_t*)&length);
848 (void)gettimeofday(&tv1, (struct timezone *)0);
849 cc = recvfrom(sock_raw, (char *)packet, PACKET_IN, 0,
850 - (struct sockaddr *)NULL, &length);
851 + (struct sockaddr *)NULL, (socklen_t*)&length);
857 char hostname[MAXHOSTNAMELEN];
864 rspace[1] = ip_opt_len;
866 rspace[3] = IPOPT_TS_PRESPEC;
867 - if (getsockname(sock_raw, (struct sockaddr*)&myaddr, &addrlen) == -1) {
868 + if (getsockname(sock_raw, (struct sockaddr*)&myaddr, (socklen_t*)&addrlen) == -1) {
869 perror("getsockname");
878 + nice_ret = nice(-16);
879 + if (nice_ret < 0) {
883 + fprintf(stderr, "nice: unknown failure\n");
886 if ((measure_status = (ip_opt_len ? measure_opt : measure)(&server)) < 0) {
888 --- iputils/rdisc.c.gcc41 2006-01-25 16:21:47.000000000 +0100
889 +++ iputils/rdisc.c 2006-01-25 16:21:47.000000000 +0100
893 cc=recvfrom(s, (char *)packet, len, 0,
894 - (struct sockaddr *)&from, &fromlen);
895 + (struct sockaddr *)&from, (socklen_t*)&fromlen);
899 --- iputils/rarpd.c.gcc41 2001-12-02 19:45:06.000000000 +0100
900 +++ iputils/rarpd.c 2006-01-25 16:21:47.000000000 +0100
903 ifl->hatype = ifrp->ifr_hwaddr.sa_family;
904 memcpy(ifl->lladdr, ifrp->ifr_hwaddr.sa_data, 14);
905 - strncpy(ifl->name, ifrp->ifr_name, IFNAMSIZ);
906 - p = strchr(ifl->name, ':');
907 + strncpy((char*)ifl->name, ifrp->ifr_name, IFNAMSIZ);
908 + p = strchr((char*)ifl->name, ':');
916 - n = recvfrom(fd, buf, sizeof(buf), MSG_DONTWAIT, (struct sockaddr*)&sll, &sll_len);
917 + n = recvfrom(fd, buf, sizeof(buf), MSG_DONTWAIT, (struct sockaddr*)&sll, (socklen_t*)&sll_len);
919 if (errno != EINTR && errno != EAGAIN)
920 syslog(LOG_ERR, "recvfrom: %m");
922 /* Update our ARP cache. Probably, this guy
923 will not able to make ARP (if it is broken)
925 - arp_advise(sll.sll_ifindex, rmap->lladdr, rmap->lladdr_len, rmap->ipaddr);
926 + arp_advise(sll.sll_ifindex,(unsigned char *)rmap->lladdr, rmap->lladdr_len, rmap->ipaddr);
928 /* Sendto is blocking, but with 5sec timeout */
931 perror("rarpd: fork");
934 + int chdir_ret = chdir("/");
935 + if (chdir_ret != 0) {
939 + fprintf(stderr, "chdir: Uknown error\n");
944 fd = open("/dev/null", O_RDWR);
947 --- iputils/ping_common.c.gcc41 2006-01-25 16:21:47.000000000 +0100
948 +++ iputils/ping_common.c 2006-01-25 16:21:47.000000000 +0100
950 static int oom_count;
955 /* Have we already sent enough? If we have, return an arbitrary positive value. */
956 if (exiting || (npackets && ntransmitted >= npackets && !deadline))
958 * high preload or pipe size is very confusing. */
959 if ((preload < screen_width && pipesize < screen_width) ||
960 in_flight() < screen_width)
961 - write(STDOUT_FILENO, ".", 1);
962 + wr_ret = write(STDOUT_FILENO, ".", 1);
964 return interval - tokens;
968 if (i == 0 && !(options & F_QUIET)) {
969 if (options & F_FLOOD)
970 - write(STDOUT_FILENO, "E", 1);
971 + wr_ret = write(STDOUT_FILENO, "E", 1);
973 perror("ping: sendmsg");
976 rcvbuf = hold = alloc * preload;
979 - setsockopt(icmp_sock, SOL_SOCKET, SO_RCVBUF, (char *)&hold, sizeof(hold));
980 - if (getsockopt(icmp_sock, SOL_SOCKET, SO_RCVBUF, (char *)&hold, &tmplen) == 0) {
981 + setsockopt(icmp_sock, SOL_SOCKET, SO_RCVBUF, (char *)&hold, (socklen_t)sizeof(hold));
982 + if (getsockopt(icmp_sock, SOL_SOCKET, SO_RCVBUF, (char *)&hold, (socklen_t*)&tmplen) == 0) {
984 fprintf(stderr, "WARNING: probably, rcvbuf is not enough to hold preload.\n");
998 if (options & F_FLOOD) {
1000 - write(STDOUT_FILENO, "\b \b", 3);
1001 + wr_ret = write(STDOUT_FILENO, "\b \b", 3);
1003 - write(STDOUT_FILENO, "\bC", 1);
1004 + wr_ret = write(STDOUT_FILENO, "\bC", 1);
1008 --- iputils/ping.c.gcc41 2006-01-25 16:21:47.000000000 +0100
1009 +++ iputils/ping.c 2006-01-25 16:21:47.000000000 +0100
1013 alen = sizeof(source);
1014 - if (getsockname(probe_fd, (struct sockaddr*)&source, &alen) == -1) {
1015 + if (getsockname(probe_fd, (struct sockaddr*)&source, (socklen_t*)&alen) == -1) {
1016 perror("getsockname");
1021 int local_errors = 0;
1022 int saved_errno = errno;
1025 iov.iov_base = &icmph;
1026 iov.iov_len = sizeof(icmph);
1028 if (options & F_QUIET)
1030 if (options & F_FLOOD)
1031 - write(STDOUT_FILENO, "E", 1);
1032 + wr_ret = write(STDOUT_FILENO, "E", 1);
1033 else if (e->ee_errno != EMSGSIZE)
1034 fprintf(stderr, "ping: local error: %s\n", strerror(e->ee_errno));
1037 if (options & F_QUIET)
1039 if (options & F_FLOOD) {
1040 - write(STDOUT_FILENO, "\bE", 2);
1041 + wr_ret = write(STDOUT_FILENO, "\bE", 2);
1043 printf("From %s icmp_seq=%u ", pr_addr(sin->sin_addr.s_addr), ntohs(icmph.un.echo.sequence));
1044 pr_icmph(e->ee_type, e->ee_code, e->ee_info, NULL);
1051 /* Check the IP header */
1052 ip = (struct iphdr *)buf;
1055 if (options & F_FLOOD) {
1057 - write(STDOUT_FILENO, "\bE", 2);
1058 + wr_ret = write(STDOUT_FILENO, "\bE", 2);
1061 printf("From %s: icmp_seq=%u ",
1064 if ((options & F_FLOOD) && !(options & (F_VERBOSE|F_QUIET))) {
1066 - write(STDOUT_FILENO, "!E", 2);
1067 + wr_ret = write(STDOUT_FILENO, "!E", 2);
1069 - write(STDOUT_FILENO, "!EC", 3);
1070 + wr_ret = write(STDOUT_FILENO, "!EC", 3);
1073 if (!(options & F_VERBOSE) || uid)
1074 --- iputils/ping6.c.OLD 2006-02-06 10:34:35.000000000 +0100
1075 +++ iputils/ping6.c 2006-02-06 10:35:38.000000000 +0100
1079 if (ipv6_addr_any(&source.sin6_addr)) {
1082 int probe_fd = socket(AF_INET6, SOCK_DGRAM, 0);
1085 --- iputils/ping.c.OLD 2006-02-06 10:34:35.000000000 +0100
1086 +++ iputils/ping.c 2006-02-06 10:34:35.000000000 +0100
1090 if (source.sin_addr.s_addr == 0) {
1093 struct sockaddr_in dst = whereto;
1094 int probe_fd = socket(AF_INET, SOCK_DGRAM, 0);
1096 @@ -855,9 +855,36 @@
1097 case ICMP_SR_FAILED:
1098 printf("Source Route Failed\n");
1100 + case ICMP_NET_UNKNOWN:
1101 + printf("Destination Net Unknown\n");
1103 + case ICMP_HOST_UNKNOWN:
1104 + printf("Destination Host Unknown\n");
1106 + case ICMP_HOST_ISOLATED:
1107 + printf("Source Host Isolated\n");
1109 + case ICMP_NET_ANO:
1110 + printf("Destination Net Prohibited\n");
1112 + case ICMP_HOST_ANO:
1113 + printf("Destination Host Prohibited\n");
1115 + case ICMP_NET_UNR_TOS:
1116 + printf("Destination Net Unreachable for Type of Service\n");
1118 + case ICMP_HOST_UNR_TOS:
1119 + printf("Destination Host Unreachable for Type of Service\n");
1121 case ICMP_PKT_FILTERED:
1122 printf("Packet filtered\n");
1124 + case ICMP_PREC_VIOLATION:
1125 + printf("Precedence Violation\n");
1127 + case ICMP_PREC_CUTOFF:
1128 + printf("Precedence Cutoff\n");
1131 printf("Dest Unreachable, Bad Code: %d\n", code);
1133 --- iputils/ping_common.c.OLD 2006-02-06 10:34:35.000000000 +0100
1134 +++ iputils/ping_common.c 2006-02-06 10:34:35.000000000 +0100
1139 - char *bp = outpack+8;
1140 + unsigned char *bp = outpack+8;
1142 for (cp = patp; *cp; cp++) {
1143 if (!isxdigit(*cp)) {
1145 void sock_setbufs(int icmp_sock, int alloc)
1148 - int tmplen = sizeof(hold);
1149 + socklen_t tmplen = sizeof(hold);
1155 if (!(options & F_PINGFILLED)) {
1157 - char *p = outpack+8;
1158 + unsigned char *p = outpack+8;
1160 /* Do not forget about case of small datalen,
1161 * fill timestamp area too!
1165 printf(", pipe %d", pipesize);
1166 - if (ntransmitted > 1 && (!interval || (options&(F_FLOOD|F_ADAPTIVE)))) {
1167 + if (ntransmitted > 1 && nreceived && (!interval || (options&(F_FLOOD|F_ADAPTIVE)))) {
1168 int ipg = (1000000*(long long)tv.tv_sec+tv.tv_usec)/(ntransmitted-1);
1169 printf(", ipg/ewma %d.%03d/%d.%03d ms",
1170 ipg/1000, ipg%1000, rtt/8000, (rtt/8)%1000);