1 diff -Naur iputils.orig/Makefile iputils/Makefile
2 --- iputils.orig/Makefile 2002-11-09 03:01:11.000000000 +0000
3 +++ iputils/Makefile 2005-06-09 16:15:32.000000000 +0000
5 GLIBCFIX=-Iinclude-glibc -include include-glibc/glibc-bugs.h
8 -ifeq ($(KERNEL_INCLUDE)/linux/pfkeyv2.h,$(wildcard $(KERNEL_INCLUDE)/linux/pfkeyv2.h))
9 - SUBDIRS=libipsec setkey
10 - LDLIBS+=-Llibipsec -lipsec
11 - IPSECDEF=-DDO_IPSEC -Ilibipsec
15 #options if you compile with libc5, and without a bind>=4.9.4 libresolv
17 # What a pity, all new gccs are buggy and -Werror does not work. Sigh.
18 #CCOPT=-D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -g -Werror
19 CCOPT=-D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -g
20 -CFLAGS=$(CCOPT) $(GLIBCFIX) -I$(KERNEL_INCLUDE) -I../include $(IPSECDEF) $(DEFINES)
21 +CFLAGS=$(CCOPT) -I../include $(IPSECDEF) $(DEFINES)
23 IPV4_TARGETS=tracepath ping clockdiff rdisc arping tftpd rarpd
24 IPV6_TARGETS=tracepath6 traceroute6 ping6
27 tftpd: tftpd.o tftpsubs.o
28 ping: ping.o ping_common.o
29 + $(LINK.o) $^ $(LDLIBS) -o $@ -Wl,-z,now -Wl,-z,relro
30 ping6: ping6.o ping_common.o
31 + $(LINK.o) $^ $(LDLIBS) -o $@ -Wl,-z,now -Wl,-z,relro
32 +traceroute6: traceroute6.o
33 + $(LINK.o) $^ $(LDLIBS) -o $@ -Wl,-z,now -Wl,-z,relro
34 ping.o ping6.o ping_common.o: ping_common.h
35 tftpd.o tftpsubs.o: tftp.h
37 diff -Naur iputils.orig/arping.c iputils/arping.c
38 --- iputils.orig/arping.c 2001-10-05 22:42:47.000000000 +0000
39 +++ iputils/arping.c 2005-06-09 16:15:24.000000000 +0000
41 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
44 +#include <asm/byteorder.h>
46 #include <sys/param.h>
47 #include <sys/socket.h>
49 #include <sys/ioctl.h>
51 #include <linux/if_arp.h>
52 +#include <linux/if_ether.h>
53 +#include <linux/if_packet.h>
57 diff -Naur iputils.orig/clockdiff.c iputils/clockdiff.c
58 --- iputils.orig/clockdiff.c 2002-02-23 00:10:59.000000000 +0000
59 +++ iputils/clockdiff.c 2005-06-09 16:15:24.000000000 +0000
61 +#include <asm/byteorder.h>
63 #include <sys/types.h>
64 #include <sys/param.h>
66 +#include <linux/types.h>
70 diff -Naur iputils.orig/include-glibc/netinet/in.h iputils/include-glibc/netinet/in.h
71 --- iputils.orig/include-glibc/netinet/in.h 2002-11-09 00:22:25.000000000 +0000
72 +++ iputils/include-glibc/netinet/in.h 2005-06-09 16:15:00.000000000 +0000
74 && (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3]))
77 -#endif /* netinet/in.h */
78 +/* Functions to convert between host and network byte order.
80 + Please note that these functions normally take `unsigned long int' or
81 + `unsigned short int' values as arguments and also return them. But
82 + this was a short-sighted decision since on different systems the types
83 + may have different representations but the values are always the same. */
85 +extern u_int32_t ntohl (u_int32_t __netlong) __THROW __attribute__ ((__const__));
86 +extern u_int16_t ntohs (u_int16_t __netshort)
87 + __THROW __attribute__ ((__const__));
88 +extern u_int32_t htonl (u_int32_t __hostlong)
89 + __THROW __attribute__ ((__const__));
90 +extern u_int16_t htons (u_int16_t __hostshort)
91 + __THROW __attribute__ ((__const__));
95 +/* Get machine dependent optimized versions of byte swapping functions. */
96 +#include <bits/byteswap.h>
99 +/* We can optimize calls to the conversion functions. Either nothing has
100 + to be done or we are using directly the byte-swapping functions which
101 + often can be inlined. */
102 +# if __BYTE_ORDER == __BIG_ENDIAN
103 +/* The host byte order is the same as network byte order,
104 + so these functions are all just identity. */
105 +# define ntohl(x) (x)
106 +# define ntohs(x) (x)
107 +# define htonl(x) (x)
108 +# define htons(x) (x)
110 +# if __BYTE_ORDER == __LITTLE_ENDIAN
111 +# define ntohl(x) __bswap_32 (x)
112 +# define ntohs(x) __bswap_16 (x)
113 +# define htonl(x) __bswap_32 (x)
114 +# define htons(x) __bswap_16 (x)
119 +#endif /* netinet/in.h */
120 diff -Naur iputils.orig/ipg iputils/ipg
121 --- iputils.orig/ipg 2001-08-02 22:37:32.000000000 +0000
122 +++ iputils/ipg 2005-06-09 16:14:49.000000000 +0000
128 +modprobe pg3 >& /dev/null
129 +modprobe pktgen >& /dev/null
132 +if [[ ! -e ${PGDEV} ]] ; then
133 + PGDEV=/proc/net/pktgen/pg0
134 + if [[ ! -e ${PGDEV} ]] ; then
135 + echo "Couldn't not locate pg in /proc/net :("
143 - echo $1 > /proc/net/pg
146 - result=`cat /proc/net/pg | fgrep "Result: OK:"`
147 + result=`cat ${PGDEV} | fgrep "Result: OK:"`
148 if [ "$result" = "" ]; then
149 - cat /proc/net/pg | fgrep Result:
150 + cat ${PGDEV} | fgrep Result:
155 - echo inject > /proc/net/pg
157 + echo inject > ${PGDEV}
162 diff -Naur iputils.orig/ping.c iputils/ping.c
163 --- iputils.orig/ping.c 2002-11-07 22:53:21.000000000 +0000
164 +++ iputils/ping.c 2005-06-09 16:15:00.000000000 +0000
167 #include "ping_common.h"
169 +#include <linux/icmp.h>
170 #include <netinet/ip.h>
171 -#include <netinet/ip_icmp.h>
173 #include <libipsec.h>
175 @@ -1213,7 +1213,7 @@
178 /* Patch bpflet for current identifier. */
179 - insns[2] = (struct sock_filter)BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __constant_htons(ident), 0, 1);
180 + insns[2] = (struct sock_filter)BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, htons(ident), 0, 1);
182 if (setsockopt(icmp_sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)))
183 perror("WARNING: failed to install socket filter\n");
184 diff -Naur iputils.orig/ping6.c iputils/ping6.c
185 --- iputils.orig/ping6.c 2002-09-20 15:08:11.000000000 +0000
186 +++ iputils/ping6.c 2005-06-09 16:15:00.000000000 +0000
189 #include "ping_common.h"
191 -#include <linux/in6.h>
192 -#include <linux/ipv6.h>
193 +struct ipv6_rt_hdr {
197 + __u8 segments_left;
200 + * type specific data
201 + * variable length field
206 + struct ipv6_rt_hdr rt_hdr;
207 + __u32 bitmap; /* strict/loose bit map */
208 + struct in6_addr addr[0];
210 +#define rt0_type rt_hdr.type;
212 +#define IPV6_SRCRT_TYPE_0 0 /* IPv6 type 0 Routing Header */
214 +#if defined(__LITTLE_ENDIAN)
217 +#elif defined(__BIG_ENDIAN)
227 + struct in6_addr saddr;
228 + struct in6_addr daddr;
231 #include <linux/icmpv6.h>
233 #define BIT_CLEAR(nr, addr) do { ((__u32 *)(addr))[(nr) >> 5] &= ~(1U << ((nr) & 31)); } while(0)
237 /* Patch bpflet for current identifier. */
238 - insns[1] = (struct sock_filter)BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __constant_htons(ident), 0, 1);
239 + insns[1] = (struct sock_filter)BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, htons(ident), 0, 1);
241 if (setsockopt(icmp_sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)))
242 perror("WARNING: failed to install socket filter\n");
243 diff -Naur iputils.orig/ping_common.h iputils/ping_common.h
244 --- iputils.orig/ping_common.h 2002-09-20 15:08:11.000000000 +0000
245 +++ iputils/ping_common.h 2005-06-09 16:15:24.000000000 +0000
247 +#include <asm/byteorder.h>
253 #include <netinet/in.h>
254 #include <arpa/inet.h>
255 +#include <linux/types.h>
256 #include <linux/errqueue.h>
258 #include "SNAPSHOT.h"
259 diff -Naur iputils.orig/rarpd.c iputils/rarpd.c
260 --- iputils.orig/rarpd.c 2001-12-02 18:45:06.000000000 +0000
261 +++ iputils/rarpd.c 2005-06-09 16:15:24.000000000 +0000
263 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
266 +#include <asm/byteorder.h>
271 #include <sys/signal.h>
272 #include <linux/if.h>
273 #include <linux/if_arp.h>
274 +#include <linux/if_ether.h>
275 #include <netinet/in.h>
276 #include <linux/if_packet.h>
277 #include <linux/filter.h>
280 char *tftp_dir = "/etc/tftpboot";
283 extern int ether_ntohost(char *name, unsigned char *ea);
285 void usage(void) __attribute__((noreturn));
290 unsigned char lladdr[16];
291 unsigned char name[IFNAMSIZ];
292 - struct ifaddr *ifa_list;
293 + struct l_ifaddr *ifa_list;
299 - struct ifaddr *next;
300 + struct l_ifaddr *next;
306 struct ifreq *ifrp, *ifend;
308 - struct ifaddr *ifa;
309 + struct l_ifaddr *ifa;
311 struct ifreq ibuf[256];
315 if (mask == 0 || prefix == 0)
317 - ifa = (struct ifaddr*)malloc(sizeof(*ifa));
318 + ifa = (struct l_ifaddr*)malloc(sizeof(*ifa));
319 memset(ifa, 0, sizeof(*ifa));
321 ifa->prefix = prefix;
322 @@ -236,10 +240,10 @@
326 -struct ifaddr *select_ipaddr(int ifindex, __u32 *sel_addr, __u32 **alist)
327 +struct l_ifaddr *select_ipaddr(int ifindex, __u32 *sel_addr, __u32 **alist)
330 - struct ifaddr *ifa;
331 + struct l_ifaddr *ifa;
338 if (hatype == ARPHRD_ETHER && halen == 6) {
339 - struct ifaddr *ifa;
340 + struct l_ifaddr *ifa;
343 static struct rarp_map emap = {
349 if (ether_ntohost(ename, lladdr) != 0 ||
353 (hp = gethostbyname(ename)) == NULL) {
355 syslog(LOG_INFO, "not found in /etc/ethers");
360 - struct ifaddr *ifa;
361 + struct l_ifaddr *ifa;
363 for (ifl=ifl_list; ifl; ifl = ifl->next)
364 if (ifl->index == ifindex)
365 diff -Naur iputils.orig/rdisc.c iputils/rdisc.c
366 --- iputils.orig/rdisc.c 2001-08-24 17:39:00.000000000 +0000
367 +++ iputils/rdisc.c 2005-06-09 16:15:24.000000000 +0000
370 * Mountain View, California 94043
372 +#include <asm/byteorder.h>
376 @@ -1504,5 +1505,5 @@
378 syslog(LOG_ERR, "%s: %m", str);
380 - (void) fprintf(stderr, "%s: %s\n", str, sys_errlist[errno]);
381 + (void) fprintf(stderr, "%s: %s\n", str, strerror(errno));
383 diff -Naur iputils.orig/tftpd.c iputils/tftpd.c
384 --- iputils.orig/tftpd.c 2002-01-24 00:31:41.000000000 +0000
385 +++ iputils/tftpd.c 2005-06-09 16:15:24.000000000 +0000
387 * This version includes many modifications by Jim Guyton <guyton@rand-unix>
390 +#include <asm/byteorder.h>
391 #include <sys/types.h>
392 #include <sys/ioctl.h>
393 #include <sys/stat.h>
396 #include <sys/socket.h>
397 #include <netinet/in.h>
398 -#include <linux/in6.h>
402 diff -Naur iputils.orig/tracepath.c iputils/tracepath.c
403 --- iputils.orig/tracepath.c 2002-11-09 04:54:46.000000000 +0000
404 +++ iputils/tracepath.c 2005-06-09 16:15:24.000000000 +0000
406 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
409 +#include <asm/byteorder.h>
413 #include <sys/socket.h>
414 +#include <linux/types.h>
415 #include <linux/errqueue.h>
424 memset(&rcvbuf, -1, sizeof(rcvbuf));
425 iov.iov_base = &rcvbuf;
426 iov.iov_len = sizeof(rcvbuf);
444 int probe_ttl(int fd, int ttl)
447 memset(sndbuf,0,mtu);
450 for (i=0; i<10; i++) {
461 hisptr = (hisptr + 1)&63;
463 diff -Naur iputils.orig/tracepath6.c iputils/tracepath6.c
464 --- iputils.orig/tracepath6.c 2001-09-02 02:03:46.000000000 +0000
465 +++ iputils/tracepath6.c 2005-06-09 16:15:24.000000000 +0000
467 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
470 +#include <asm/byteorder.h>
474 #include <sys/socket.h>
475 #include <netinet/in.h>
477 -#include <linux/in6.h>
478 +#include <linux/types.h>
479 #include <linux/errqueue.h>
488 memset(&rcvbuf, -1, sizeof(rcvbuf));
489 iov.iov_base = &rcvbuf;
490 iov.iov_len = sizeof(rcvbuf);
500 @@ -222,34 +222,29 @@
508 int probe_ttl(int fd, int ttl)
513 struct probehdr *hdr = (struct probehdr*)sndbuf;
517 - for (i=0; i<10; i++) {
521 - gettimeofday(&hdr->tv, NULL);
522 - if (send(fd, sndbuf, mtu-overhead, 0) > 0)
524 - res = recverr(fd, ttl);
535 + for (i=0; i<10; i++) {
537 + gettimeofday(&hdr->tv, NULL);
538 + if (send(fd, sndbuf, mtu-overhead, 0) > 0)
540 + res = recverr(fd, ttl);
549 if (recv(fd, sndbuf, sizeof(sndbuf), MSG_DONTWAIT) > 0) {
550 printf("%2d?: reply received 8)\n", ttl);
553 res = recverr(fd, ttl);
560 diff -Naur iputils.orig/traceroute6.c iputils/traceroute6.c
561 --- iputils.orig/traceroute6.c 2002-10-03 03:29:23.000000000 +0000
562 +++ iputils/traceroute6.c 2005-06-09 16:14:49.000000000 +0000
563 @@ -244,11 +244,30 @@
564 #include <netinet/in.h>
565 #include <netinet/ip.h>
566 #include <netinet/ip_icmp.h>
568 +#include <linux/udp.h>
570 #include <netinet/udp.h>
573 +#include <linux/types.h>
575 +#if defined(__LITTLE_ENDIAN)
578 +#elif defined(__BIG_ENDIAN)
584 -#include <linux/ipv6.h>
585 -#include <linux/in6.h>
590 + struct in6_addr saddr;
591 + struct in6_addr daddr;
593 #include <linux/icmpv6.h>
595 #include <arpa/inet.h>