Added iputils to core

This commit is contained in:
Kevin Mihelich 2011-01-13 09:21:25 -05:00
parent 18c35be69c
commit af9664d9da
7 changed files with 2295 additions and 0 deletions

63
core/iputils/PKGBUILD Normal file
View file

@ -0,0 +1,63 @@
# $Id: PKGBUILD 82625 2010-06-15 04:22:56Z allan $
# Maintainer: Aaron Griffin <aaron@archlinux.org>
plugrel=1
pkgname=iputils
pkgver=20100214
_traceroutever=1.4a12
pkgrel=2
pkgdesc="IP Configuration Utilities (and Ping)"
arch=(i686 x86_64)
license=('GPL')
url="http://www.linuxfoundation.org/en/Net:Iputils"
groups=('base')
depends=('glibc')
makedepends=('opensp' 'libxslt' 'docbook-xsl')
conflicts=('netkit-base' 'arping' 'netkit-tftpd' 'traceroute')
replaces=('netkit-base' 'traceroute')
source=(http://www.skbuff.net/iputils/$pkgname-s$pkgver.tar.bz2
ftp://ftp.ee.lbl.gov/traceroute-$_traceroutever.tar.gz
permission-fix.patch)
options=(!makeflags)
md5sums=('37596c8b3eed537294e77464b9804726'
'964d599ef696efccdeebe7721cd4828d'
'66109966cad06e425bb12a78bab85b70')
build()
{
#build iptuils
cd $srcdir/$pkgname-s$pkgver
make KERNEL_INCLUDE=/usr/include || return 1 # for i686
for i in arping clockdiff rarpd rdisc tftpd tracepath tracepath6; do
install -D -m755 $i $pkgdir/usr/sbin/$i
done
for i in ping ping6 traceroute6; do
install -D -m4755 $i $pkgdir/bin/$i
done
msg ":: building docs"
# good god, these docs are a pain
# special thanks to Michael(tm) Smith <mike@w3.org> - http://people.w3.org/mike/
# from #docbook on freenode.org for figuring this out
cd doc
for file in *.sgml; do
xf=${file/.sgml/.xml}
osx -xlower -xno-nl-in-tag $file > $xf || true
sed -i "s|<refname>\(.*\), \(.*\)</refname>|<refname>\1</refname>, <refname>\2</refname>|g" $xf
xsltproc /usr/share/xml/docbook/xsl-stylesheets-1.75.2/manpages/docbook.xsl $xf
done
mkdir -p $pkgdir/usr/share/man/man8
install -m644 arping.8 clockdiff.8 ping.8 ping6.8 rarpd.8 rdisc.8 \
tftpd.8 tracepath.8 tracepath6.8 traceroute6.8 \
$pkgdir/usr/share/man/man8/
# build traceroute
# this is combined in this package because it's awkward as a separate package
cd ${srcdir}/traceroute-$_traceroutever
patch -Np1 -i ../permission-fix.patch || return 1
./configure --prefix=/usr --sbindir=/bin --mandir=/usr/share/man
make CFLAGS="${CFLAGS} -Ilinux-include/" || return 1
make DESTDIR=${pkgdir} install install-man
}

View file

@ -0,0 +1,595 @@
diff -Naur iputils.orig/Makefile iputils/Makefile
--- iputils.orig/Makefile 2002-11-09 03:01:11.000000000 +0000
+++ iputils/Makefile 2005-06-09 16:15:32.000000000 +0000
@@ -17,11 +17,6 @@
GLIBCFIX=-Iinclude-glibc -include include-glibc/glibc-bugs.h
endif
-ifeq ($(KERNEL_INCLUDE)/linux/pfkeyv2.h,$(wildcard $(KERNEL_INCLUDE)/linux/pfkeyv2.h))
- SUBDIRS=libipsec setkey
- LDLIBS+=-Llibipsec -lipsec
- IPSECDEF=-DDO_IPSEC -Ilibipsec
-endif
#options if you compile with libc5, and without a bind>=4.9.4 libresolv
@@ -31,7 +26,7 @@
# 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) -I$(KERNEL_INCLUDE) -I../include $(IPSECDEF) $(DEFINES)
+CFLAGS=$(CCOPT) -I../include $(IPSECDEF) $(DEFINES)
IPV4_TARGETS=tracepath ping clockdiff rdisc arping tftpd rarpd
IPV6_TARGETS=tracepath6 traceroute6 ping6
@@ -42,7 +37,11 @@
tftpd: tftpd.o tftpsubs.o
ping: ping.o ping_common.o
+ $(LINK.o) $^ $(LDLIBS) -o $@ -Wl,-z,now -Wl,-z,relro
ping6: ping6.o ping_common.o
+ $(LINK.o) $^ $(LDLIBS) -o $@ -Wl,-z,now -Wl,-z,relro
+traceroute6: traceroute6.o
+ $(LINK.o) $^ $(LDLIBS) -o $@ -Wl,-z,now -Wl,-z,relro
ping.o ping6.o ping_common.o: ping_common.h
tftpd.o tftpsubs.o: tftp.h
diff -Naur iputils.orig/arping.c iputils/arping.c
--- iputils.orig/arping.c 2001-10-05 22:42:47.000000000 +0000
+++ iputils/arping.c 2005-06-09 16:15:24.000000000 +0000
@@ -9,6 +9,7 @@
* Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
*/
+#include <asm/byteorder.h>
#include <stdlib.h>
#include <sys/param.h>
#include <sys/socket.h>
@@ -19,6 +20,8 @@
#include <sys/ioctl.h>
#include <linux/if.h>
#include <linux/if_arp.h>
+#include <linux/if_ether.h>
+#include <linux/if_packet.h>
#include <sys/uio.h>
#include <netdb.h>
diff -Naur iputils.orig/clockdiff.c iputils/clockdiff.c
--- iputils.orig/clockdiff.c 2002-02-23 00:10:59.000000000 +0000
+++ iputils/clockdiff.c 2005-06-09 16:15:24.000000000 +0000
@@ -1,7 +1,9 @@
+#include <asm/byteorder.h>
#include <time.h>
#include <sys/types.h>
#include <sys/param.h>
#include <stdio.h>
+#include <linux/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <math.h>
diff -Naur iputils.orig/include-glibc/netinet/in.h iputils/include-glibc/netinet/in.h
--- iputils.orig/include-glibc/netinet/in.h 2002-11-09 00:22:25.000000000 +0000
+++ iputils/include-glibc/netinet/in.h 2005-06-09 16:15:00.000000000 +0000
@@ -65,4 +65,45 @@
&& (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3]))
-#endif /* netinet/in.h */
+/* Functions to convert between host and network byte order.
+
+ Please note that these functions normally take `unsigned long int' or
+ `unsigned short int' values as arguments and also return them. But
+ this was a short-sighted decision since on different systems the types
+ may have different representations but the values are always the same. */
+
+extern u_int32_t ntohl (u_int32_t __netlong) __THROW __attribute__ ((__const__));
+extern u_int16_t ntohs (u_int16_t __netshort)
+ __THROW __attribute__ ((__const__));
+extern u_int32_t htonl (u_int32_t __hostlong)
+ __THROW __attribute__ ((__const__));
+extern u_int16_t htons (u_int16_t __hostshort)
+ __THROW __attribute__ ((__const__));
+
+#include <endian.h>
+
+/* Get machine dependent optimized versions of byte swapping functions. */
+#include <bits/byteswap.h>
+
+#ifdef __OPTIMIZE__
+/* We can optimize calls to the conversion functions. Either nothing has
+ to be done or we are using directly the byte-swapping functions which
+ often can be inlined. */
+# if __BYTE_ORDER == __BIG_ENDIAN
+/* The host byte order is the same as network byte order,
+ so these functions are all just identity. */
+# define ntohl(x) (x)
+# define ntohs(x) (x)
+# define htonl(x) (x)
+# define htons(x) (x)
+# else
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+# define ntohl(x) __bswap_32 (x)
+# define ntohs(x) __bswap_16 (x)
+# define htonl(x) __bswap_32 (x)
+# define htons(x) __bswap_16 (x)
+# endif
+# endif
+#endif
+
+#endif /* netinet/in.h */
diff -Naur iputils.orig/ipg iputils/ipg
--- iputils.orig/ipg 2001-08-02 22:37:32.000000000 +0000
+++ iputils/ipg 2005-06-09 16:14:49.000000000 +0000
@@ -1,21 +1,31 @@
-#! /bin/bash
+#!/bin/bash
-modprobe pg3
+modprobe pg3 >& /dev/null
+modprobe pktgen >& /dev/null
+
+PGDEV=/proc/net/pg
+if [[ ! -e ${PGDEV} ]] ; then
+ PGDEV=/proc/net/pktgen/pg0
+ if [[ ! -e ${PGDEV} ]] ; then
+ echo "Couldn't not locate pg in /proc/net :("
+ exit 1
+ fi
+fi
function pgset() {
local result
- echo $1 > /proc/net/pg
+ echo $1 > ${PGDEV}
- result=`cat /proc/net/pg | fgrep "Result: OK:"`
+ result=`cat ${PGDEV} | fgrep "Result: OK:"`
if [ "$result" = "" ]; then
- cat /proc/net/pg | fgrep Result:
+ cat ${PGDEV} | fgrep Result:
fi
}
function pg() {
- echo inject > /proc/net/pg
- cat /proc/net/pg
+ echo inject > ${PGDEV}
+ cat ${PGDEV}
}
pgset "odev eth0"
diff -Naur iputils.orig/ping.c iputils/ping.c
--- iputils.orig/ping.c 2002-11-07 22:53:21.000000000 +0000
+++ iputils/ping.c 2005-06-09 16:15:00.000000000 +0000
@@ -60,8 +60,8 @@
#include "ping_common.h"
+#include <linux/icmp.h>
#include <netinet/ip.h>
-#include <netinet/ip_icmp.h>
#ifdef DO_IPSEC
#include <libipsec.h>
#endif
@@ -1213,7 +1213,7 @@
once = 1;
/* Patch bpflet for current identifier. */
- insns[2] = (struct sock_filter)BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __constant_htons(ident), 0, 1);
+ insns[2] = (struct sock_filter)BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, htons(ident), 0, 1);
if (setsockopt(icmp_sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)))
perror("WARNING: failed to install socket filter\n");
diff -Naur iputils.orig/ping6.c iputils/ping6.c
--- iputils.orig/ping6.c 2002-09-20 15:08:11.000000000 +0000
+++ iputils/ping6.c 2005-06-09 16:15:00.000000000 +0000
@@ -68,8 +68,44 @@
*/
#include "ping_common.h"
-#include <linux/in6.h>
-#include <linux/ipv6.h>
+struct ipv6_rt_hdr {
+ __u8 nexthdr;
+ __u8 hdrlen;
+ __u8 type;
+ __u8 segments_left;
+
+ /*
+ * type specific data
+ * variable length field
+ */
+};
+
+struct rt0_hdr {
+ struct ipv6_rt_hdr rt_hdr;
+ __u32 bitmap; /* strict/loose bit map */
+ struct in6_addr addr[0];
+
+#define rt0_type rt_hdr.type;
+};
+#define IPV6_SRCRT_TYPE_0 0 /* IPv6 type 0 Routing Header */
+struct ipv6hdr {
+#if defined(__LITTLE_ENDIAN)
+ __u8 priority:4,
+ version:4;
+#elif defined(__BIG_ENDIAN)
+ __u8 version:4,
+ priority:4;
+#endif
+ __u8 flow_lbl[3];
+
+ __u16 payload_len;
+ __u8 nexthdr;
+ __u8 hop_limit;
+
+ struct in6_addr saddr;
+ struct in6_addr daddr;
+};
+
#include <linux/icmpv6.h>
#define BIT_CLEAR(nr, addr) do { ((__u32 *)(addr))[(nr) >> 5] &= ~(1U << ((nr) & 31)); } while(0)
@@ -879,7 +915,7 @@
once = 1;
/* Patch bpflet for current identifier. */
- insns[1] = (struct sock_filter)BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __constant_htons(ident), 0, 1);
+ insns[1] = (struct sock_filter)BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, htons(ident), 0, 1);
if (setsockopt(icmp_sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)))
perror("WARNING: failed to install socket filter\n");
diff -Naur iputils.orig/ping_common.h iputils/ping_common.h
--- iputils.orig/ping_common.h 2002-09-20 15:08:11.000000000 +0000
+++ iputils/ping_common.h 2005-06-09 16:15:24.000000000 +0000
@@ -1,3 +1,4 @@
+#include <asm/byteorder.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -19,6 +20,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <linux/types.h>
#include <linux/errqueue.h>
#include "SNAPSHOT.h"
diff -Naur iputils.orig/rarpd.c iputils/rarpd.c
--- iputils.orig/rarpd.c 2001-12-02 18:45:06.000000000 +0000
+++ iputils/rarpd.c 2005-06-09 16:15:24.000000000 +0000
@@ -9,6 +9,7 @@
* Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
*/
+#include <asm/byteorder.h>
#include <stdio.h>
#include <syslog.h>
#include <dirent.h>
@@ -26,6 +27,7 @@
#include <sys/signal.h>
#include <linux/if.h>
#include <linux/if_arp.h>
+#include <linux/if_ether.h>
#include <netinet/in.h>
#include <linux/if_packet.h>
#include <linux/filter.h>
@@ -42,7 +44,9 @@
char *ifname;
char *tftp_dir = "/etc/tftpboot";
+#ifndef __UCLIBC__
extern int ether_ntohost(char *name, unsigned char *ea);
+#endif
void usage(void) __attribute__((noreturn));
struct iflink
@@ -52,12 +56,12 @@
int hatype;
unsigned char lladdr[16];
unsigned char name[IFNAMSIZ];
- struct ifaddr *ifa_list;
+ struct l_ifaddr *ifa_list;
} *ifl_list;
-struct ifaddr
+struct l_ifaddr
{
- struct ifaddr *next;
+ struct l_ifaddr *next;
__u32 prefix;
__u32 mask;
__u32 local;
@@ -89,7 +93,7 @@
int fd;
struct ifreq *ifrp, *ifend;
struct iflink *ifl;
- struct ifaddr *ifa;
+ struct l_ifaddr *ifa;
struct ifconf ifc;
struct ifreq ibuf[256];
@@ -180,7 +184,7 @@
if (ifa == NULL) {
if (mask == 0 || prefix == 0)
continue;
- ifa = (struct ifaddr*)malloc(sizeof(*ifa));
+ ifa = (struct l_ifaddr*)malloc(sizeof(*ifa));
memset(ifa, 0, sizeof(*ifa));
ifa->local = addr;
ifa->prefix = prefix;
@@ -236,10 +240,10 @@
return dent != NULL;
}
-struct ifaddr *select_ipaddr(int ifindex, __u32 *sel_addr, __u32 **alist)
+struct l_ifaddr *select_ipaddr(int ifindex, __u32 *sel_addr, __u32 **alist)
{
struct iflink *ifl;
- struct ifaddr *ifa;
+ struct l_ifaddr *ifa;
int retry = 0;
int i;
@@ -295,7 +299,7 @@
if (r == NULL) {
if (hatype == ARPHRD_ETHER && halen == 6) {
- struct ifaddr *ifa;
+ struct l_ifaddr *ifa;
struct hostent *hp;
char ename[256];
static struct rarp_map emap = {
@@ -305,7 +309,11 @@
6,
};
+#ifndef __UCLIBC__
if (ether_ntohost(ename, lladdr) != 0 ||
+#else
+ if (
+#endif
(hp = gethostbyname(ename)) == NULL) {
if (verbose)
syslog(LOG_INFO, "not found in /etc/ethers");
@@ -364,7 +372,7 @@
{
__u32 laddr = 0;
struct iflink *ifl;
- struct ifaddr *ifa;
+ struct l_ifaddr *ifa;
for (ifl=ifl_list; ifl; ifl = ifl->next)
if (ifl->index == ifindex)
diff -Naur iputils.orig/rdisc.c iputils/rdisc.c
--- iputils.orig/rdisc.c 2001-08-24 17:39:00.000000000 +0000
+++ iputils/rdisc.c 2005-06-09 16:15:24.000000000 +0000
@@ -25,6 +25,7 @@
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
+#include <asm/byteorder.h>
#include <stdio.h>
#include <errno.h>
#include <signal.h>
@@ -1504,5 +1505,5 @@
if (logging)
syslog(LOG_ERR, "%s: %m", str);
else
- (void) fprintf(stderr, "%s: %s\n", str, sys_errlist[errno]);
+ (void) fprintf(stderr, "%s: %s\n", str, strerror(errno));
}
diff -Naur iputils.orig/tftpd.c iputils/tftpd.c
--- iputils.orig/tftpd.c 2002-01-24 00:31:41.000000000 +0000
+++ iputils/tftpd.c 2005-06-09 16:15:24.000000000 +0000
@@ -48,6 +48,7 @@
* This version includes many modifications by Jim Guyton <guyton@rand-unix>
*/
+#include <asm/byteorder.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
@@ -57,7 +58,6 @@
#include <sys/socket.h>
#include <netinet/in.h>
-#include <linux/in6.h>
#include <netdb.h>
#include <setjmp.h>
diff -Naur iputils.orig/tracepath.c iputils/tracepath.c
--- iputils.orig/tracepath.c 2002-11-09 04:54:46.000000000 +0000
+++ iputils/tracepath.c 2005-06-09 16:15:24.000000000 +0000
@@ -9,10 +9,12 @@
* Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
*/
+#include <asm/byteorder.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
+#include <linux/types.h>
#include <linux/errqueue.h>
#include <errno.h>
#include <string.h>
@@ -76,7 +78,7 @@
int progress = -1;
int broken_router;
-restart:
+ while (1) {
memset(&rcvbuf, -1, sizeof(rcvbuf));
iov.iov_base = &rcvbuf;
iov.iov_len = sizeof(rcvbuf);
@@ -93,7 +95,7 @@
if (res < 0) {
if (errno == EAGAIN)
return progress;
- goto restart;
+ continue;
}
progress = mtu;
@@ -216,7 +218,7 @@
perror("NET ERROR");
return 0;
}
- goto restart;
+ }
}
int probe_ttl(int fd, int ttl)
@@ -227,7 +229,6 @@
memset(sndbuf,0,mtu);
-restart:
for (i=0; i<10; i++) {
int res;
@@ -243,7 +244,8 @@
if (res==0)
return 0;
if (res > 0)
- goto restart;
+ i = 0;
+ continue;
}
hisptr = (hisptr + 1)&63;
diff -Naur iputils.orig/tracepath6.c iputils/tracepath6.c
--- iputils.orig/tracepath6.c 2001-09-02 02:03:46.000000000 +0000
+++ iputils/tracepath6.c 2005-06-09 16:15:24.000000000 +0000
@@ -9,13 +9,13 @@
* Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
*/
+#include <asm/byteorder.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
-
-#include <linux/in6.h>
+#include <linux/types.h>
#include <linux/errqueue.h>
#include <errno.h>
#include <string.h>
@@ -66,7 +66,7 @@
int progress = -1;
int broken_router;
-restart:
+ while (1) {
memset(&rcvbuf, -1, sizeof(rcvbuf));
iov.iov_base = &rcvbuf;
iov.iov_len = sizeof(rcvbuf);
@@ -83,7 +83,7 @@
if (res < 0) {
if (errno == EAGAIN)
return progress;
- goto restart;
+ continue;
}
progress = 2;
@@ -222,34 +222,29 @@
perror("NET ERROR");
return 0;
}
- goto restart;
+ }
}
int probe_ttl(int fd, int ttl)
{
- int i;
+ int i=0, res;
char sndbuf[mtu];
struct probehdr *hdr = (struct probehdr*)sndbuf;
-restart:
-
- for (i=0; i<10; i++) {
- int res;
-
- hdr->ttl = ttl;
- gettimeofday(&hdr->tv, NULL);
- if (send(fd, sndbuf, mtu-overhead, 0) > 0)
- break;
- res = recverr(fd, ttl);
- if (res==0)
- return 0;
- if (res > 0)
- goto restart;
- }
-
- if (i<10) {
- int res;
-
+ while (i<10) {
+ for (i=0; i<10; i++) {
+ hdr->ttl = ttl;
+ gettimeofday(&hdr->tv, NULL);
+ if (send(fd, sndbuf, mtu-overhead, 0) > 0)
+ break;
+ res = recverr(fd, ttl);
+ if (res==0)
+ return 0;
+ if (res > 0) {
+ i = 0;
+ continue;
+ }
+ }
data_wait(fd);
if (recv(fd, sndbuf, sizeof(sndbuf), MSG_DONTWAIT) > 0) {
printf("%2d?: reply received 8)\n", ttl);
@@ -257,7 +252,7 @@
}
res = recverr(fd, ttl);
if (res == 1)
- goto restart;
+ continue;
return res;
}
diff -Naur iputils.orig/traceroute6.c iputils/traceroute6.c
--- iputils.orig/traceroute6.c 2002-10-03 03:29:23.000000000 +0000
+++ iputils/traceroute6.c 2005-06-09 16:14:49.000000000 +0000
@@ -244,11 +244,30 @@
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
+#if __linux__
+#include <linux/udp.h>
+#else
#include <netinet/udp.h>
+#endif
+
+#include <linux/types.h>
+struct ipv6hdr {
+#if defined(__LITTLE_ENDIAN)
+ __u8 priority:4,
+ version:4;
+#elif defined(__BIG_ENDIAN)
+ __u8 version:4,
+ priority:4;
+#endif
+ __u8 flow_lbl[3];
-#include <linux/ipv6.h>
-#include <linux/in6.h>
+ __u16 payload_len;
+ __u8 nexthdr;
+ __u8 hop_limit;
+ struct in6_addr saddr;
+ struct in6_addr daddr;
+};
#include <linux/icmpv6.h>
#include <arpa/inet.h>

View file

@ -0,0 +1,239 @@
diff -urN iputils.orig/Makefile iputils/Makefile
--- iputils.orig/Makefile 2004-05-02 20:30:43.000000000 +0000
+++ iputils/Makefile 2004-05-02 20:30:48.000000000 +0000
@@ -1,5 +1,4 @@
# Path to parent kernel include files directory
-KERNEL_INCLUDE=/usr/src/linux/include
LIBC_INCLUDE=/usr/include
DEFINES=
@@ -8,21 +7,6 @@
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))
- GLIBCFIX=-Iinclude-glibc -include include-glibc/glibc-bugs.h
- endif
-endif
-ifeq ($(LIBC_INCLUDE)/bits/socket.h,$(wildcard $(LIBC_INCLUDE)/bits/socket.h))
- GLIBCFIX=-Iinclude-glibc -include include-glibc/glibc-bugs.h
-endif
-
-ifeq ($(KERNEL_INCLUDE)/linux/pfkeyv2.h,$(wildcard $(KERNEL_INCLUDE)/linux/pfkeyv2.h))
- SUBDIRS=libipsec setkey
- LDLIBS+=-Llibipsec -lipsec
- IPSECDEF=-DDO_IPSEC -Ilibipsec
-endif
-
#options if you compile with libc5, and without a bind>=4.9.4 libresolv
# NOT AVAILABLE. Please, use libresolv.
@@ -31,13 +15,13 @@
# 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) -I$(KERNEL_INCLUDE) -I../include $(IPSECDEF) $(DEFINES)
+CFLAGS=$(CCOPT) -I../include $(IPSECDEF) $(DEFINES)
IPV4_TARGETS=tracepath ping clockdiff rdisc arping tftpd rarpd
IPV6_TARGETS=tracepath6 traceroute6 ping6
TARGETS=$(IPV4_TARGETS) $(IPV6_TARGETS)
-all: check-kernel subdirs $(TARGETS)
+all: subdirs $(TARGETS)
tftpd: tftpd.o tftpsubs.o
@@ -51,15 +35,6 @@
rdisc_srv.o: rdisc.c
$(CC) $(CFLAGS) -DRDISC_SERVER -o rdisc_srv.o rdisc.c
-check-kernel:
-ifeq ($(KERNEL_INCLUDE),)
- @echo "Please, set correct KERNEL_INCLUDE"; false
-else
- @set -e; \
- if [ ! -r $(KERNEL_INCLUDE)/linux/autoconf.h ]; then \
- echo "Please, set correct KERNEL_INCLUDE"; false; fi
-endif
-
subdirs:
ifneq ($(SUBDIRS),)
@set -e; \
diff -urN iputils.orig/arping.c iputils/arping.c
--- iputils.orig/arping.c 2004-05-02 20:30:43.000000000 +0000
+++ iputils/arping.c 2004-05-02 20:32:38.000000000 +0000
@@ -9,6 +9,7 @@
* Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
*/
+#include <asm/byteorder.h>
#include <stdlib.h>
#include <sys/param.h>
#include <sys/socket.h>
@@ -19,6 +20,8 @@
#include <sys/ioctl.h>
#include <linux/if.h>
#include <linux/if_arp.h>
+#include <linux/if_ether.h>
+#include <linux/if_packet.h>
#include <sys/uio.h>
#include <netdb.h>
diff -urN iputils.orig/clockdiff.c iputils/clockdiff.c
--- iputils.orig/clockdiff.c 2004-05-02 20:30:43.000000000 +0000
+++ iputils/clockdiff.c 2004-05-02 20:30:48.000000000 +0000
@@ -1,3 +1,4 @@
+#include <asm/byteorder.h>
#include <time.h>
#include <sys/types.h>
#include <sys/param.h>
diff -urN iputils.orig/ping.c iputils/ping.c
--- iputils.orig/ping.c 2004-05-02 20:30:43.000000000 +0000
+++ iputils/ping.c 2004-05-02 20:31:03.000000000 +0000
@@ -61,7 +61,7 @@
#include "ping_common.h"
#include <netinet/ip.h>
-#include <netinet/ip_icmp.h>
+#include <linux/icmp.h>
#ifdef DO_IPSEC
#include <libipsec.h>
#endif
diff -urN iputils.orig/ping_common.h iputils/ping_common.h
--- iputils.orig/ping_common.h 2004-05-02 20:30:43.000000000 +0000
+++ iputils/ping_common.h 2004-05-02 20:30:48.000000000 +0000
@@ -1,3 +1,4 @@
+#include <asm/byteorder.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
diff -urN iputils.orig/rarpd.c iputils/rarpd.c
--- iputils.orig/rarpd.c 2004-05-02 20:30:43.000000000 +0000
+++ iputils/rarpd.c 2004-05-02 20:33:07.000000000 +0000
@@ -9,6 +9,7 @@
* Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
*/
+#include <asm/byteorder.h>
#include <stdio.h>
#include <syslog.h>
#include <dirent.h>
@@ -26,6 +27,7 @@
#include <sys/signal.h>
#include <linux/if.h>
#include <linux/if_arp.h>
+#include <linux/if_ether.h>
#include <netinet/in.h>
#include <linux/if_packet.h>
#include <linux/filter.h>
@@ -52,12 +54,12 @@
int hatype;
unsigned char lladdr[16];
unsigned char name[IFNAMSIZ];
- struct ifaddr *ifa_list;
+ struct l_ifaddr *ifa_list;
} *ifl_list;
-struct ifaddr
+struct l_ifaddr
{
- struct ifaddr *next;
+ struct l_ifaddr *next;
__u32 prefix;
__u32 mask;
__u32 local;
@@ -89,7 +91,7 @@
int fd;
struct ifreq *ifrp, *ifend;
struct iflink *ifl;
- struct ifaddr *ifa;
+ struct l_ifaddr *ifa;
struct ifconf ifc;
struct ifreq ibuf[256];
@@ -180,7 +182,7 @@
if (ifa == NULL) {
if (mask == 0 || prefix == 0)
continue;
- ifa = (struct ifaddr*)malloc(sizeof(*ifa));
+ ifa = (struct l_ifaddr*)malloc(sizeof(*ifa));
memset(ifa, 0, sizeof(*ifa));
ifa->local = addr;
ifa->prefix = prefix;
@@ -236,10 +238,10 @@
return dent != NULL;
}
-struct ifaddr *select_ipaddr(int ifindex, __u32 *sel_addr, __u32 **alist)
+struct l_ifaddr *select_ipaddr(int ifindex, __u32 *sel_addr, __u32 **alist)
{
struct iflink *ifl;
- struct ifaddr *ifa;
+ struct l_ifaddr *ifa;
int retry = 0;
int i;
@@ -295,7 +297,7 @@
if (r == NULL) {
if (hatype == ARPHRD_ETHER && halen == 6) {
- struct ifaddr *ifa;
+ struct l_ifaddr *ifa;
struct hostent *hp;
char ename[256];
static struct rarp_map emap = {
@@ -364,7 +366,7 @@
{
__u32 laddr = 0;
struct iflink *ifl;
- struct ifaddr *ifa;
+ struct l_ifaddr *ifa;
for (ifl=ifl_list; ifl; ifl = ifl->next)
if (ifl->index == ifindex)
diff -urN iputils.orig/rdisc.c iputils/rdisc.c
--- iputils.orig/rdisc.c 2004-05-02 20:30:43.000000000 +0000
+++ iputils/rdisc.c 2004-05-02 20:30:48.000000000 +0000
@@ -25,6 +25,7 @@
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
+#include <asm/byteorder.h>
#include <stdio.h>
#include <errno.h>
#include <signal.h>
diff -urN iputils.orig/tftpd.c iputils/tftpd.c
--- iputils.orig/tftpd.c 2004-05-02 20:30:43.000000000 +0000
+++ iputils/tftpd.c 2004-05-02 20:30:48.000000000 +0000
@@ -48,6 +48,7 @@
* This version includes many modifications by Jim Guyton <guyton@rand-unix>
*/
+#include <asm/byteorder.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
diff -urN iputils.orig/tracepath.c iputils/tracepath.c
--- iputils.orig/tracepath.c 2004-05-02 20:30:43.000000000 +0000
+++ iputils/tracepath.c 2004-05-02 20:30:48.000000000 +0000
@@ -9,6 +9,7 @@
* Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
*/
+#include <asm/byteorder.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
diff -urN iputils.orig/traceroute6.c iputils/traceroute6.c
--- iputils.orig/traceroute6.c 2004-05-02 20:30:43.000000000 +0000
+++ iputils/traceroute6.c 2004-05-02 20:30:48.000000000 +0000
@@ -230,6 +230,7 @@
* Tue Dec 20 03:50:13 PST 1988
*/
+#include <asm/byteorder.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>

1170
core/iputils/iputils.patch Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
--- traceroute-1.4a12/Makefile.in.old 2000-11-23 21:05:29.000000000 +0100
+++ traceroute-1.4a12/Makefile.in 2008-09-27 20:04:30.000000000 +0200
@@ -90,10 +90,10 @@
sed -e 's/.*/char version[] = "&";/' $(srcdir)/VERSION > $@
install: force
- $(INSTALL) -m 4555 -o root -g bin traceroute $(DESTDIR)$(BINDEST)
+ $(INSTALL) -m 4555 -o root -g root traceroute $(DESTDIR)$(BINDEST)
install-man: force
- $(INSTALL) -m 444 -o bin -g bin traceroute.8 $(DESTDIR)$(MANDEST)/man8
+ $(INSTALL) -m 644 -o root -g root traceroute.8 $(DESTDIR)$(MANDEST)/man8
lint: $(GENSRC) force
lint -hbxn $(SRC) | \

18
core/iputils/protocols Normal file
View file

@ -0,0 +1,18 @@
#
# protocols This file describes the various protocols that are
# available from the TCP/IP subsystem. It should be
# consulted instead of using the numbers in the ARPA
# include files, or, worse, just guessing them.
#
ip 0 IP # internet protocol, pseudo protocol number
icmp 1 ICMP # internet control message protocol
igmp 2 IGMP # internet group multicast protocol
ggp 3 GGP # gateway-gateway protocol
tcp 6 TCP # transmission control protocol
pup 12 PUP # PARC universal packet protocol
udp 17 UDP # user datagram protocol
idp 22 IDP # WhatsThis?
raw 255 RAW # RAW IP interface
# End.

195
core/iputils/services Normal file
View file

@ -0,0 +1,195 @@
#
# Network services, Internet style
#
# Note that it is presently the policy of IANA to assign a single well-known
# port number for both TCP and UDP; hence, most entries here have two entries
# even if the protocol doesn't support UDP operations.
# Updated from RFC 1340, ``Assigned Numbers'' (July 1992). Not all ports
# are included, only the more common ones.
#
# from: @(#)services 5.8 (Berkeley) 5/9/91
# $Id: services,v 1.8 2005/07/08 19:20:10 judd Exp $
#
tcpmux 1/tcp # TCP port service multiplexer
echo 7/tcp
echo 7/udp
discard 9/tcp sink null
discard 9/udp sink null
systat 11/tcp users
daytime 13/tcp
daytime 13/udp
netstat 15/tcp
qotd 17/tcp quote
msp 18/tcp # message send protocol
msp 18/udp # message send protocol
chargen 19/tcp ttytst source
chargen 19/udp ttytst source
ftp-data 20/tcp
ftp 21/tcp
ssh 22/tcp
telnet 23/tcp
# 24 - private
smtp 25/tcp mail
# 26 - unassigned
time 37/tcp timserver
time 37/udp timserver
rlp 39/udp resource # resource location
nameserver 42/tcp name # IEN 116
whois 43/tcp nicname
domain 53/tcp nameserver # name-domain server
domain 53/udp nameserver
mtp 57/tcp # deprecated
bootps 67/tcp # BOOTP server
bootps 67/udp
bootpc 68/tcp # BOOTP client
bootpc 68/udp
tftp 69/udp
gopher 70/tcp # Internet Gopher
gopher 70/udp
rje 77/tcp netrjs
finger 79/tcp
www 80/tcp http # WorldWideWeb HTTP
www 80/udp # HyperText Transfer Protocol
link 87/tcp ttylink
kerberos 88/tcp krb5 # Kerberos v5
kerberos 88/udp
supdup 95/tcp
# 100 - reserved
hostnames 101/tcp hostname # usually from sri-nic
iso-tsap 102/tcp tsap # part of ISODE.
csnet-ns 105/tcp cso-ns # also used by CSO name server
csnet-ns 105/udp cso-ns
rtelnet 107/tcp # Remote Telnet
rtelnet 107/udp
pop2 109/tcp postoffice # POP version 2
pop2 109/udp
pop3 110/tcp # POP version 3
pop3 110/udp
sunrpc 111/tcp
sunrpc 111/udp
auth 113/tcp tap ident authentication
sftp 115/tcp
uucp-path 117/tcp
nntp 119/tcp readnews untp # USENET News Transfer Protocol
ntp 123/tcp
ntp 123/udp # Network Time Protocol
netbios-ns 137/tcp # NETBIOS Name Service
netbios-ns 137/udp
netbios-dgm 138/tcp # NETBIOS Datagram Service
netbios-dgm 138/udp
netbios-ssn 139/tcp # NETBIOS session service
netbios-ssn 139/udp
imap 143/tcp # An alias for imap2
imap 143/udp
imap2 143/tcp # Interim Mail Access Proto v2
imap2 143/udp
snmp 161/udp # Simple Net Mgmt Proto
snmp-trap 162/udp snmptrap # Traps for SNMP
cmip-man 163/tcp # ISO mgmt over IP (CMOT)
cmip-man 163/udp
cmip-agent 164/tcp
cmip-agent 164/udp
xdmcp 177/tcp # X Display Mgr. Control Proto
xdmcp 177/udp
nextstep 178/tcp NeXTStep NextStep # NeXTStep window
nextstep 178/udp NeXTStep NextStep # server
bgp 179/tcp # Border Gateway Proto.
bgp 179/udp
prospero 191/tcp # Cliff Neuman's Prospero
prospero 191/udp
irc 194/tcp # Internet Relay Chat
irc 194/udp
smux 199/tcp # SNMP Unix Multiplexer
smux 199/udp
at-rtmp 201/tcp # AppleTalk routing
at-rtmp 201/udp
at-nbp 202/tcp # AppleTalk name binding
at-nbp 202/udp
at-echo 204/tcp # AppleTalk echo
at-echo 204/udp
at-zis 206/tcp # AppleTalk zone information
at-zis 206/udp
z3950 210/tcp wais # NISO Z39.50 database
z3950 210/udp wais
ipx 213/tcp # IPX
ipx 213/udp
imap3 220/tcp # Interactive Mail Access
imap3 220/udp # Protocol v3
ulistserv 372/tcp # UNIX Listserv
ulistserv 372/udp
https 443/tcp
#
# UNIX specific services
#
exec 512/tcp
biff 512/udp comsat
login 513/tcp
who 513/udp whod
shell 514/tcp cmd # no passwords used
syslog 514/udp
printer 515/tcp spooler # line printer spooler
talk 517/udp
ntalk 518/udp
route 520/udp router routed # RIP
timed 525/udp timeserver
tempo 526/tcp newdate
courier 530/tcp rpc
conference 531/tcp chat
netnews 532/tcp readnews
netwall 533/udp # -for emergency broadcasts
uucp 540/tcp uucpd # uucp daemon
remotefs 556/tcp rfs_server rfs # Brunhoff remote filesystem
klogin 543/tcp # Kerberized `rlogin' (v5)
kshell 544/tcp # Kerberized `rsh' (v5)
kerberos-adm 749/tcp # Kerberos `kadmin' (v5)
#
webster 765/tcp # Network dictionary
webster 765/udp
rsync 873/tcp # RSYNC Server
rsync 873/udp
swat 901/tcp # SWAT
imaps 993/tcp # SSL IMAP
imaps 993/udp
pop3s 995/tcp
pop3s 995/udp
#
# From ``Assigned Numbers'':
#
#> The Registered Ports are not controlled by the IANA and on most systems
#> can be used by ordinary user processes or programs executed by ordinary
#> users.
#
#> Ports are used in the TCP [45,106] to name the ends of logical
#> connections which carry long term conversations. For the purpose of
#> providing services to unknown callers, a service contact port is
#> defined. This list specifies the port used by the server process as its
#> contact port. While the IANA can not control uses of these ports it
#> does register or list uses of these ports as a convienence to the
#> community.
#
ingreslock 1524/tcp
ingreslock 1524/udp
prospero-np 1525/tcp # Prospero non-privileged
prospero-np 1525/udp
rfe 5002/tcp # Radio Free Ethernet
rfe 5002/udp # Actually uses UDP only
#
#
# Kerberos (Project Athena/MIT) services
# Note that these are for Kerberos v4, and are unofficial. Sites running
# v4 should uncomment these and comment out the v5 entries above.
#
#kerberos 750/udp kdc # Kerberos (server) udp
#kerberos 750/tcp kdc # Kerberos (server) tcp
krbupdate 760/tcp kreg # Kerberos registration
kpasswd 761/tcp kpwd # Kerberos "passwd"
#klogin 543/tcp # Kerberos rlogin
eklogin 2105/tcp # Kerberos encrypted rlogin
#kshell 544/tcp krcmd # Kerberos remote shell
svn 3690/tcp # Subversion Server
svn 3690/udp # Subversion Server
#
# Unofficial but necessary (for NetBSD) services
#
supfilesrv 871/tcp # SUP server
supfiledbg 1127/tcp # SUP debugging