iputils: apply patch from #463
authorKoen Kooi <koen@openembedded.org>
Fri, 28 Apr 2006 10:16:04 +0000 (10:16 +0000)
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>
Fri, 28 Apr 2006 10:16:04 +0000 (10:16 +0000)
* this will need patching to work with glibc 2.4 due to the ipv6 changes

packages/iputils/files/.mtn2git_empty [new file with mode: 0644]
packages/iputils/files/debian-fixes.patch [new file with mode: 0644]
packages/iputils/files/iputils-retvals.patch [new file with mode: 0644]
packages/iputils/files/makefile.patch [new file with mode: 0644]
packages/iputils/files/remove-glibc-headers.patch [new file with mode: 0644]
packages/iputils/files/standard-header-types.patch [new file with mode: 0644]
packages/iputils/files/tracepath6-mtu-opt.patch [new file with mode: 0644]
packages/iputils/iputils_20020927.bb

diff --git a/packages/iputils/files/.mtn2git_empty b/packages/iputils/files/.mtn2git_empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/packages/iputils/files/debian-fixes.patch b/packages/iputils/files/debian-fixes.patch
new file mode 100644 (file)
index 0000000..1b014f0
--- /dev/null
@@ -0,0 +1,133 @@
+Fixes taken from the lastest debian .deb pacakge (20020927-3).
+
+--- iputils-20020927.orig/ping.c
++++ iputils-20020927/ping.c
+@@ -232,7 +232,7 @@
+                       if (argc == 1)
+                               options |= F_NUMERIC;
+               } else {
+-                      hp = gethostbyname(target);
++                      hp = gethostbyname2(target, AF_INET);
+                       if (!hp) {
+                               fprintf(stderr, "ping: unknown host %s\n", target);
+                               exit(2);
+@@ -373,8 +373,13 @@
+                             (1<<ICMP_PARAMETERPROB)|
+                             (1<<ICMP_REDIRECT)|
+                             (1<<ICMP_ECHOREPLY));
+-              if (setsockopt(icmp_sock, SOL_RAW, ICMP_FILTER, (char*)&filt, sizeof(filt)) == -1)
++              if (setsockopt(icmp_sock, SOL_RAW, ICMP_FILTER, 
++                              (char*)&filt, sizeof(filt)) == -1)
++              {
+                       perror("WARNING: setsockopt(ICMP_FILTER)");
++                      fprintf(stderr, 
++                              "Do you have CONFIG_SOCKET in your kernel?");
++              }
+       }
+       hold = 1;
+@@ -848,9 +853,36 @@
+               case ICMP_SR_FAILED:
+                       printf("Source Route Failed\n");
+                       break;
++              case ICMP_NET_UNKNOWN:
++                      printf("Destination Net Unknown\n");
++                      break;
++              case ICMP_HOST_UNKNOWN:
++                      printf("Destination Host Unknown\n");
++                      break;
++              case ICMP_HOST_ISOLATED:
++                      printf("Source Host Isolated\n");
++                      break;
++              case ICMP_NET_ANO:
++                      printf("Destination Net Prohibited\n");
++                      break;
++              case ICMP_HOST_ANO:
++                      printf("Destination Host Prohibited\n");
++                      break;
++              case ICMP_NET_UNR_TOS:
++                      printf("Destination Net Unreachable for Type of Service\n");
++                      break;
++              case ICMP_HOST_UNR_TOS:
++                      printf("Destination Host Unreachable for Type of Service\n");
++                      break;
+               case ICMP_PKT_FILTERED:
+                       printf("Packet filtered\n");
+                       break;
++              case ICMP_PREC_VIOLATION:
++                      printf("Precedence Violation\n");
++                      break;
++              case ICMP_PREC_CUTOFF:
++                      printf("Precedence Cutoff\n");
++                      break;
+               default:
+                       printf("Dest Unreachable, Bad Code: %d\n", code);
+                       break;
+--- iputils-20020927.orig/ping6.c
++++ iputils-20020927/ping6.c
+@@ -440,7 +440,6 @@
+       /*
+        *      select icmp echo reply as icmp type to receive
+        */
+-
+       ICMPV6_FILTER_SETBLOCKALL(&filter);
+       if (!working_recverr) {
+--- iputils-20020927.orig/tracepath.c
++++ iputils-20020927/tracepath.c
+@@ -307,9 +307,9 @@
+               base_port = atoi(p+1);
+       } else
+               base_port = 44444;
+-      he = gethostbyname(argv[0]);
++      he = gethostbyname2(argv[0], AF_INET);
+       if (he == NULL) {
+-              herror("gethostbyname");
++              herror("gethostbyname2");
+               exit(1);
+       }
+       memcpy(&target.sin_addr, he->h_addr, 4);
+--- iputils-20020927.orig/traceroute6.c
++++ iputils-20020927/traceroute6.c
+@@ -441,7 +441,7 @@
+                * to fix something send the patch to me for sanity checking.
+                * "datalen" patch is a shit. */
+               if ((unsigned int)datalen == 0)
+-                      datalen == sizeof(struct pkt_format);
++                      datalen = sizeof(struct pkt_format);
+       }
+       if (datalen < (int)sizeof(struct pkt_format) || datalen >= MAXPACKET) {
+--- iputils-20020927.orig/ping_common.c
++++ iputils-20020927/ping_common.c
+@@ -435,6 +435,7 @@
+       if (options & F_SO_DONTROUTE)
+               setsockopt(icmp_sock, SOL_SOCKET, SO_DONTROUTE, (char *)&hold, sizeof(hold));
++#ifndef __sparc__ /* XXX SO_TIMESTAMP seems broken on sparc */
+ #ifdef SO_TIMESTAMP
+       if (!(options&F_LATENCY)) {
+               int on = 1;
+@@ -442,6 +443,7 @@
+                       fprintf(stderr, "Warning: no SO_TIMESTAMP support, falling back to SIOCGSTAMP\n");
+       }
+ #endif
++#endif /* __sparc__ */
+       /* Set some SNDTIMEO to prevent blocking forever
+        * on sends, when device is too slow or stalls. Just put limit
+@@ -817,7 +819,8 @@
+       }
+       if (pipesize > 1)
+               printf(", pipe %d", pipesize);
+-      if (ntransmitted > 1 && (!interval || (options&(F_FLOOD|F_ADAPTIVE)))) {
++      if (ntransmitted > 1 && nreceived && 
++                      (!interval || (options&(F_FLOOD|F_ADAPTIVE)))) {
+               int ipg = (1000000*(long long)tv.tv_sec+tv.tv_usec)/(ntransmitted-1);
+               printf(", ipg/ewma %d.%03d/%d.%03d ms",
+                      ipg/1000, ipg%1000, rtt/8000, (rtt/8)%1000);
+@@ -851,4 +854,3 @@
+       }
+       fprintf(stderr, "\n");
+ }
+-
diff --git a/packages/iputils/files/iputils-retvals.patch b/packages/iputils/files/iputils-retvals.patch
new file mode 100644 (file)
index 0000000..73ef8a3
--- /dev/null
@@ -0,0 +1,49 @@
+From the fedora core SRPM. Outputs error message and exists if the
+command is not suid root or run as user root. 
+
+--- iputils/traceroute6.c.old  2004-12-07 11:08:57.000000000 +0100
++++ iputils/traceroute6.c      2004-12-07 11:14:09.397575536 +0100
+@@ -352,8 +352,11 @@
+       icmp_sock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
+       socket_errno = errno;
+-      setuid(getuid());
+-
++      if(setuid(getuid()) != 0)
++      {
++              perror("traceroute: setuid()");
++              exit(-1);
++      }
+       on = 1;
+       seq = tos = 0;
+       to = (struct sockaddr_in6 *)&whereto;
+--- iputils/ping6.c.old        2004-12-07 11:08:57.000000000 +0100
++++ iputils/ping6.c    2004-12-07 11:13:40.707937024 +0100
+@@ -223,7 +223,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));
+--- iputils/ping.c.old 2004-12-07 11:08:57.000000000 +0100
++++ iputils/ping.c     2004-12-07 11:13:27.523941296 +0100
+@@ -119,7 +119,11 @@
+       socket_errno = errno;
+       uid = getuid();
+-      setuid(uid);
++      if(setuid(uid) != 0)
++      {
++              perror("ping: setuid()");
++              exit(-1);
++      }
+       source.sin_family = AF_INET;
diff --git a/packages/iputils/files/makefile.patch b/packages/iputils/files/makefile.patch
new file mode 100644 (file)
index 0000000..6cc35ad
--- /dev/null
@@ -0,0 +1,49 @@
+Update the makefile: Stop building it as a debug version by default,
+remove the manual mangling of the include directories and don't build
+the clockdiff, rdisc, tftp or rarpd components (everyone uses version
+provided by other packages.)
+
+--- new/Makefile       2005/11/14 13:34:06     1.1
++++ new/Makefile       2005/11/14 13:40:13
+@@ -1,37 +1,17 @@
+-# Path to parent kernel include files directory
+-KERNEL_INCLUDE=/usr/src/linux/include
+-LIBC_INCLUDE=/usr/include
+-
+-DEFINES= 
+-
+ #options if you have a bind>=4.9.4 libresolv (or, maybe, glibc)
+ 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
+-
+-
+-#options if you compile with libc5, and without a bind>=4.9.4 libresolv
+-# NOT AVAILABLE. Please, use libresolv.
+ CC=gcc
+ # 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 $(DEFINES) 
++CCOPT=-D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall
++CFLAGS=$(CCOPT) -I$(KERNEL_INCLUDE) $(DEFINES) 
+-IPV4_TARGETS=tracepath ping clockdiff rdisc arping tftpd rarpd
++IPV4_TARGETS=tracepath ping arping
+ IPV6_TARGETS=tracepath6 traceroute6 ping6
+ TARGETS=$(IPV4_TARGETS) $(IPV6_TARGETS)
+-all: check-kernel $(TARGETS)
++all: $(TARGETS)
+ tftpd: tftpd.o tftpsubs.o
diff --git a/packages/iputils/files/remove-glibc-headers.patch b/packages/iputils/files/remove-glibc-headers.patch
new file mode 100644 (file)
index 0000000..0930acd
--- /dev/null
@@ -0,0 +1,944 @@
+We are not using the local glibc headers for now.
+Remove them to keep them out of the way.
+
+diff -durN orig/include-glibc/bits/socket.h new/include-glibc/bits/socket.h
+--- orig/include-glibc/bits/socket.h   2005-11-14 22:37:26.000000000 +1100
++++ new/include-glibc/bits/socket.h    1970-01-01 10:00:00.000000000 +1000
+@@ -1,280 +0,0 @@
+-/* System-specific socket constants and types.  Linux version.
+-   Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
+-   This file is part of the GNU C Library.
+-
+-   The GNU C Library is free software; you can redistribute it and/or
+-   modify it under the terms of the GNU Library General Public License as
+-   published by the Free Software Foundation; either version 2 of the
+-   License, or (at your option) any later version.
+-
+-   The GNU C Library is distributed in the hope that it will be useful,
+-   but WITHOUT ANY WARRANTY; without even the implied warranty of
+-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+-   Library General Public License for more details.
+-
+-   You should have received a copy of the GNU Library General Public
+-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+-   Boston, MA 02111-1307, USA.  */
+-
+-#ifndef       _SOCKETBITS_H
+-
+-#define       _SOCKETBITS_H   1
+-#include <features.h>
+-
+-#define       __need_size_t
+-#define __need_NULL
+-#include <stddef.h>
+-
+-
+-__BEGIN_DECLS
+-
+-/* Type for length arguments in socket calls.  */
+-#ifndef __socklen_t_defined
+-typedef unsigned int socklen_t;
+-# define __socklen_t_defined
+-#endif
+-
+-/* Types of sockets.  */
+-enum __socket_type
+-{
+-#ifndef __mips__
+-  SOCK_STREAM = 1,            /* Sequenced, reliable, connection-based
+-                                 byte streams.  */
+-#define SOCK_STREAM SOCK_STREAM
+-  SOCK_DGRAM = 2,             /* Connectionless, unreliable datagrams
+-                                 of fixed maximum length.  */
+-#define SOCK_DGRAM SOCK_DGRAM
+-#else
+-  SOCK_STREAM = 2,            /* Sequenced, reliable, connection-based
+-                                 byte streams.  */
+-#define SOCK_STREAM SOCK_STREAM
+-  SOCK_DGRAM = 1,             /* Connectionless, unreliable datagrams
+-                                 of fixed maximum length.  */
+-#define SOCK_DGRAM SOCK_DGRAM
+-#endif
+-  SOCK_RAW = 3,                       /* Raw protocol interface.  */
+-#define SOCK_RAW SOCK_RAW
+-  SOCK_RDM = 4,                       /* Reliably-delivered messages.  */
+-#define SOCK_RDM SOCK_RDM
+-  SOCK_SEQPACKET = 5,         /* Sequenced, reliable, connection-based,
+-                                 datagrams of fixed maximum length.  */
+-#define SOCK_SEQPACKET SOCK_SEQPACKET
+-  SOCK_PACKET = 10            /* Linux specific way of getting packets
+-                                 at the dev level.  For writing rarp and
+-                                 other similar things on the user level. */
+-#define SOCK_PACKET SOCK_PACKET
+-};
+-
+-/* Protocol families.  */
+-#define       PF_UNSPEC       0       /* Unspecified.  */
+-#define       PF_LOCAL        1       /* Local to host (pipes and file-domain).  */
+-#define       PF_UNIX         PF_LOCAL /* Old BSD name for PF_LOCAL.  */
+-#define       PF_FILE         PF_LOCAL /* POSIX name for PF_LOCAL.  */
+-#define       PF_INET         2       /* IP protocol family.  */
+-#define       PF_AX25         3       /* Amateur Radio AX.25.  */
+-#define       PF_IPX          4       /* Novell Internet Protocol.  */
+-#define       PF_APPLETALK    5       /* Don't use this.  */
+-#define       PF_NETROM       6       /* Amateur radio NetROM.  */
+-#define       PF_BRIDGE       7       /* Multiprotocol bridge.  */
+-#define       PF_AAL5         8       /* Reserved for Werner's ATM.  */
+-#define       PF_X25          9       /* Reserved for X.25 project.  */
+-#define       PF_INET6        10      /* IP version 6.  */
+-#define       PF_ROSE         11      /* Amateur Radio X.25 PLP       */
+-#define       PF_DECnet       12      /* Reserved for DECnet project  */
+-#define       PF_NETBEUI      13      /* Reserved for 802.2LLC project*/
+-#define       PF_SECURITY     14      /* Security callback pseudo AF */
+-#define       PF_KEY          15      /* PF_KEY key management API */
+-#define       PF_NETLINK      16
+-#define       PF_ROUTE        PF_NETLINK /* Alias to emulate 4.4BSD */
+-#define       PF_PACKET       17      /* Packet family                */
+-#define       PF_MAX          32      /* For now.. */
+-
+-/* Address families.  */
+-#define       AF_UNSPEC       PF_UNSPEC
+-#define       AF_LOCAL        PF_LOCAL
+-#define       AF_UNIX         PF_UNIX
+-#define       AF_FILE         PF_FILE
+-#define       AF_INET         PF_INET
+-#define       AF_AX25         PF_AX25
+-#define       AF_IPX          PF_IPX
+-#define       AF_APPLETALK    PF_APPLETALK
+-#define       AF_NETROM       PF_NETROM
+-#define       AF_BRIDGE       PF_BRIDGE
+-#define       AF_AAL5         PF_AAL5
+-#define       AF_X25          PF_X25
+-#define       AF_INET6        PF_INET6
+-#define       AF_ROSE         PF_ROSE
+-#define       AF_DECnet       PF_DECnet
+-#define       AF_NETBEUI      PF_NETBEUI
+-#define       AF_SECURITY     PF_SECURITY
+-#define       pseudo_AF_KEY   pseudo_PF_KEY
+-#define       AF_NETLINK      PF_NETLINK
+-#define       AF_ROUTE        PF_ROUTE
+-#define       AF_PACKET       PF_PACKET
+-#define       AF_MAX          PF_MAX
+-
+-/* Socket level values.  Others are defined in the appropriate headers.
+-
+-   XXX These definitions also should go into the appropriate headers as
+-   far as they are available.  */
+-#define SOL_IPV6        41
+-#define SOL_ICMPV6    58
+-#define SOL_RAW               255
+-#define SOL_AX25        257
+-#define SOL_ATALK     258
+-#define SOL_NETROM    259
+-#define SOL_ROSE      260
+-#define SOL_DECNET    261
+-#define SOL_X25               262
+-
+-/* Maximum queue length specifiable by listen.  */
+-#define SOMAXCONN     128
+-
+-/* Get the definition of the macro to define the common sockaddr members.  */
+-#if __GLIBC_MINOR__  >= 1
+-#include <bits/sockaddr.h>
+-#else
+-#include <sockaddrcom.h>
+-#endif
+-
+-/* Structure describing a generic socket address.  */
+-struct sockaddr
+-  {
+-    __SOCKADDR_COMMON (sa_);  /* Common data: address family and length.  */
+-    char sa_data[14];         /* Address data.  */
+-  };
+-
+-
+-/* Bits in the FLAGS argument to `send', `recv', et al.  */
+-enum
+-  {
+-    MSG_OOB           = 0x01, /* Process out-of-band data.  */
+-#define MSG_OOB               MSG_OOB
+-    MSG_PEEK          = 0x02, /* Peek at incoming messages.  */
+-#define MSG_PEEK      MSG_PEEK
+-    MSG_DONTROUTE     = 0x04, /* Don't use local routing.  */
+-#define MSG_DONTROUTE MSG_DONTROUTE
+-    MSG_CTRUNC                = 0x08, /* Control data lost before delivery.  */
+-#define MSG_CTRUNC    MSG_CTRUNC
+-    MSG_PROBE         = 0x10,
+-#define MSG_PROBE     MSG_PROBE
+-    MSG_TRUNC         = 0x20,
+-#define MSG_TRUNC     MSG_TRUNC
+-    MSG_DONTWAIT      = 0x40,
+-#define MSG_DONTWAIT  MSG_DONTWAIT
+-    MSG_WAITALL               = 0x100,
+-#define MSG_WAITALL   MSG_WAITALL
+-    MSG_CONFIRM               = 0x800,
+-#define MSG_CONFIRM   MSG_CONFIRM
+-    MSG_ERRQUEUE      = 0x2000,
+-#define MSG_ERRQUEUE  MSG_ERRQUEUE
+-    MSG_NOSIGNAL      = 0x4000,
+-#define MSG_NOSIGNAL  MSG_NOSIGNAL
+-  };
+-
+-/* Structure describing messages sent by
+-   `sendmsg' and received by `recvmsg'.  */
+-struct msghdr
+-  {
+-    __ptr_t msg_name;         /* Address to send to/receive from.  */
+-    socklen_t msg_namelen;    /* Length of address data.  */
+-
+-    struct iovec *msg_iov;    /* Vector of data to send/receive into.  */
+-    size_t msg_iovlen;                /* Number of elements in the vector.  */
+-
+-    __ptr_t msg_control;      /* Ancillary data (eg BSD filedesc passing). */
+-    size_t msg_controllen;    /* Ancillary data buffer length.  */
+-
+-    int msg_flags;            /* Flags on received message.  */
+-  };
+-
+-/* Structure used for storage of ancillary data object information.  */
+-struct cmsghdr
+-  {
+-    size_t cmsg_len;          /* Length of data in cmsg_data plus length
+-                                 of cmsghdr structure.  */
+-    int cmsg_level;           /* Originating protocol.  */
+-    int cmsg_type;            /* Protocol specific type.  */
+-#if !defined __STRICT_ANSI__ && defined __GNUC__ && __GNUC__ >= 2
+-    unsigned char __cmsg_data[0]; /* Ancillary data.  */
+-#endif
+-  };
+-
+-/* Ancillary data object manipulation macros.  */
+-#if !defined __STRICT_ANSI__ && defined __GNUC__ && __GNUC__ >= 2
+-# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
+-#else
+-# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
+-#endif
+-#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
+-#define CMSG_FIRSTHDR(mhdr) \
+-  ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr)               \
+-   ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL)
+-#define CMSG_ALIGN(len) ( ((len)+sizeof(long)-1) & ~(sizeof(long)-1) )
+-#define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len))
+-#define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
+-
+-
+-#ifndef _EXTERN_INLINE
+-# define _EXTERN_INLINE extern __inline
+-#endif
+-extern struct cmsghdr *__cmsg_nxthdr __P ((struct msghdr *__mhdr,
+-                                         struct cmsghdr *__cmsg));
+-_EXTERN_INLINE struct cmsghdr *
+-__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)
+-{
+-  if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
+-        /* The kernel header does this so there may be a reason.  */
+-        return NULL;
+-
+-  __cmsg = (struct cmsghdr *) 
+-        ((unsigned char *) __cmsg + CMSG_ALIGN(__cmsg->cmsg_len));  
+-
+-  if ( (unsigned char *) (__cmsg + 1) >= 
+-         (unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)
+-        /* No more entries.  */
+-        return NULL;
+-  return __cmsg;
+-}
+-
+-/* Socket level message types.  This must match the definitions in
+-   <linux/socket.h>.  */
+-enum
+-  {
+-    SCM_RIGHTS = 0x01,         /* Data array contains access rights.  */
+-#define SCM_RIGHTS SCM_RIGHTS
+-    SCM_CREDENTIALS = 0x02,  /* Data array is `struct ucred'.  */
+-#define SCM_CREDENTIALS SCM_CREDENTIALS
+-  };
+-
+-
+-
+-/* Get socket manipulation related informations from kernel headers.  */
+-#ifdef THIS_IS_CRAP
+-#ifndef _LINUX_TYPES_H
+-# define _LINUX_TYPES_H
+-#endif
+-#endif
+-
+-#include <asm/socket.h>
+-#include <asm/types.h>
+-
+-struct ucred
+-{
+-      __u32   pid;
+-      __u32   uid;
+-      __u32   gid;
+-};
+-
+-
+-/* Structure used to manipulate the SO_LINGER option.  */
+-struct linger
+-  {
+-    int l_onoff;              /* Nonzero to linger on close.  */
+-    int l_linger;             /* Time to linger.  */
+-  };
+-
+-__END_DECLS
+-
+-#endif /* socketbits.h */
+diff -durN orig/include-glibc/bits/sockunion.h new/include-glibc/bits/sockunion.h
+--- orig/include-glibc/bits/sockunion.h        2005-11-14 22:37:26.000000000 +1100
++++ new/include-glibc/bits/sockunion.h 1970-01-01 10:00:00.000000000 +1000
+@@ -1,25 +0,0 @@
+-
+-/* I cannot describe, how I laughed, when saw, that now sys/socket.h
+-   includes ALL OF networking include files. 8)8)8)
+-
+-   Bravo! Aah, they forgot sockaddr_ll, sockaddr_pkt and sockaddr_nl...
+-   Not a big problem, we only start the way to single UNIVERSAL include file:
+-
+-   #include <GNU-Gnu_is_Not_Unix.h>.
+-
+-   Jokes apart, it is full crap. Removed.
+-   --ANK
+-
+- */
+-
+-/* Union of all sockaddr types (required by IPv6 Basic API).  This is
+-   somewhat evil.  */
+-/* 8)8) Well, ipngwg really does strange things sometimes, but
+-   not in such extent! It is removed long ago --ANK
+- */
+-
+-union sockaddr_union
+-  {
+-    struct sockaddr sa;
+-    char __maxsize[128];
+-  };
+diff -durN orig/include-glibc/glibc-bugs.h new/include-glibc/glibc-bugs.h
+--- orig/include-glibc/glibc-bugs.h    2005-11-14 22:37:26.000000000 +1100
++++ new/include-glibc/glibc-bugs.h     1970-01-01 10:00:00.000000000 +1000
+@@ -1,20 +0,0 @@
+-#ifndef __GLIBC_BUGS_H__
+-#define __GLIBC_BUGS_H__ 1
+-
+-#include <features.h>
+-#include <sys/types.h>
+-
+-#if defined(__GLIBC__) && __GLIBC__ >= 2
+-
+-#ifndef __KERNEL_STRICT_NAMES
+-#define __KERNEL_STRICT_NAMES 1
+-#endif
+-
+-#include <linux/types.h>
+-
+-typedef __u16 in_port_t;
+-typedef __u32 in_addr_t;
+-
+-#endif
+-
+-#endif
+diff -durN orig/include-glibc/netinet/in.h new/include-glibc/netinet/in.h
+--- orig/include-glibc/netinet/in.h    2005-11-14 22:37:26.000000000 +1100
++++ new/include-glibc/netinet/in.h     1970-01-01 10:00:00.000000000 +1000
+@@ -1,11 +0,0 @@
+-#ifndef       _NETINET_IN_H
+-#define       _NETINET_IN_H   1
+-
+-#include "glibc-bugs.h"
+-#include <sys/socket.h>
+-#include <sys/types.h>
+-#include <linux/in.h>
+-
+-#define SOL_IP        0
+-
+-#endif        /* netinet/in.h */
+diff -durN orig/include-glibc/netinet/ip.h new/include-glibc/netinet/ip.h
+--- orig/include-glibc/netinet/ip.h    2005-11-14 22:37:26.000000000 +1100
++++ new/include-glibc/netinet/ip.h     1970-01-01 10:00:00.000000000 +1000
+@@ -1,98 +0,0 @@
+-#ifndef __NETINET_IP_H
+-#define __NETINET_IP_H 1
+-
+-#include <glibc-bugs.h>
+-#include <netinet/in.h>
+-
+-#include <linux/ip.h>
+-
+-#ifdef __USE_BSD
+-/*
+- * Copyright (c) 1982, 1986, 1993
+- *    The Regents of the University of California.  All rights reserved.
+- *
+- * Redistribution and use in source and binary forms, with or without
+- * modification, are permitted provided that the following conditions
+- * are met:
+- * 1. Redistributions of source code must retain the above copyright
+- *    notice, this list of conditions and the following disclaimer.
+- * 2. Redistributions in binary form must reproduce the above copyright
+- *    notice, this list of conditions and the following disclaimer in the
+- *    documentation and/or other materials provided with the distribution.
+- * 3. All advertising materials mentioning features or use of this software
+- *    must display the following acknowledgement:
+- *    This product includes software developed by the University of
+- *    California, Berkeley and its contributors.
+- * 4. Neither the name of the University nor the names of its contributors
+- *    may be used to endorse or promote products derived from this software
+- *    without specific prior written permission.
+- *
+- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+- * SUCH DAMAGE.
+- *
+- *    @(#)ip.h        8.1 (Berkeley) 6/10/93
+- */
+-
+-/*
+- * Definitions for internet protocol version 4.
+- * Per RFC 791, September 1981.
+- */
+-
+-/*
+- * Structure of an internet header, naked of options.
+- */
+-struct ip
+-  {
+-#if __BYTE_ORDER == __LITTLE_ENDIAN
+-    u_int8_t ip_hl:4;                 /* header length */
+-    u_int8_t ip_v:4;                  /* version */
+-#endif
+-#if __BYTE_ORDER == __BIG_ENDIAN
+-    u_int8_t ip_v:4;                  /* version */
+-    u_int8_t ip_hl:4;                 /* header length */
+-#endif
+-    u_int8_t ip_tos;                  /* type of service */
+-    u_short ip_len;                   /* total length */
+-    u_short ip_id;                    /* identification */
+-    u_short ip_off;                   /* fragment offset field */
+-#define       IP_RF 0x8000                    /* reserved fragment flag */
+-#define       IP_DF 0x4000                    /* dont fragment flag */
+-#define       IP_MF 0x2000                    /* more fragments flag */
+-#define       IP_OFFMASK 0x1fff               /* mask for fragmenting bits */
+-    u_int8_t ip_ttl;                  /* time to live */
+-    u_int8_t ip_p;                    /* protocol */
+-    u_short ip_sum;                   /* checksum */
+-    struct in_addr ip_src, ip_dst;    /* source and dest address */
+-  };
+-
+-/*
+- * Time stamp option structure.
+- */
+-struct ip_timestamp
+-  {
+-    u_int8_t ipt_code;                        /* IPOPT_TS */
+-    u_int8_t ipt_len;                 /* size of structure (variable) */
+-    u_int8_t ipt_ptr;                 /* index of current entry */
+-#if __BYTE_ORDER == __LITTLE_ENDIAN
+-    u_int8_t ipt_flg:4;                       /* flags, see below */
+-    u_int8_t ipt_oflw:4;              /* overflow counter */
+-#endif
+-#if __BYTE_ORDER == __BIG_ENDIAN
+-    u_int8_t ipt_oflw:4;              /* overflow counter */
+-    u_int8_t ipt_flg:4;                       /* flags, see below */
+-#endif
+-    u_int32_t data[9];
+-  };
+-#endif /* __USE_BSD */
+-
+-
+-#endif /* netinet/ip.h */
+diff -durN orig/include-glibc/netinet/ip_icmp.h new/include-glibc/netinet/ip_icmp.h
+--- orig/include-glibc/netinet/ip_icmp.h       2005-11-14 22:37:26.000000000 +1100
++++ new/include-glibc/netinet/ip_icmp.h        1970-01-01 10:00:00.000000000 +1000
+@@ -1,199 +0,0 @@
+-#ifndef __NETINET_IP_ICMP_H
+-#define __NETINET_IP_ICMP_H    1
+-
+-
+-#include <asm/types.h>
+-#include <linux/icmp.h>
+-
+-#ifdef __USE_BSD
+-/*
+- * Copyright (c) 1982, 1986, 1993
+- *    The Regents of the University of California.  All rights reserved.
+- *
+- * Redistribution and use in source and binary forms, with or without
+- * modification, are permitted provided that the following conditions
+- * are met:
+- * 1. Redistributions of source code must retain the above copyright
+- *    notice, this list of conditions and the following disclaimer.
+- * 2. Redistributions in binary form must reproduce the above copyright
+- *    notice, this list of conditions and the following disclaimer in the
+- *    documentation and/or other materials provided with the distribution.
+- * 3. All advertising materials mentioning features or use of this software
+- *    must display the following acknowledgement:
+- *    This product includes software developed by the University of
+- *    California, Berkeley and its contributors.
+- * 4. Neither the name of the University nor the names of its contributors
+- *    may be used to endorse or promote products derived from this software
+- *    without specific prior written permission.
+- *
+- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+- * SUCH DAMAGE.
+- *
+- *    @(#)ip_icmp.h   8.1 (Berkeley) 6/10/93
+- */
+-
+-#include <netinet/in.h>
+-#include <netinet/ip.h>
+-
+-/*
+- * Internal of an ICMP Router Advertisement
+- */
+-struct icmp_ra_addr
+-{
+-  u_int32_t ira_addr;
+-  u_int32_t ira_preference;
+-};
+-
+-struct icmp
+-{
+-  u_int8_t  icmp_type;        /* type of message, see below */
+-  u_int8_t  icmp_code;        /* type sub code */
+-  u_int16_t icmp_cksum;       /* ones complement checksum of struct */
+-  union
+-  {
+-    u_char ih_pptr;           /* ICMP_PARAMPROB */
+-    struct in_addr ih_gwaddr; /* gateway address */
+-    struct ih_idseq           /* echo datagram */
+-    {
+-      u_int16_t icd_id;
+-      u_int16_t icd_seq;
+-    } ih_idseq;
+-    u_int32_t ih_void;
+-
+-    /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
+-    struct ih_pmtu
+-    {
+-      u_int16_t ipm_void;
+-      u_int16_t ipm_nextmtu;
+-    } ih_pmtu;
+-
+-    struct ih_rtradv
+-    {
+-      u_int8_t irt_num_addrs;
+-      u_int8_t irt_wpa;
+-      u_int16_t irt_lifetime;
+-    } ih_rtradv;
+-  } icmp_hun;
+-#define       icmp_pptr       icmp_hun.ih_pptr
+-#define       icmp_gwaddr     icmp_hun.ih_gwaddr
+-#define       icmp_id         icmp_hun.ih_idseq.icd_id
+-#define       icmp_seq        icmp_hun.ih_idseq.icd_seq
+-#define       icmp_void       icmp_hun.ih_void
+-#define       icmp_pmvoid     icmp_hun.ih_pmtu.ipm_void
+-#define       icmp_nextmtu    icmp_hun.ih_pmtu.ipm_nextmtu
+-#define       icmp_num_addrs  icmp_hun.ih_rtradv.irt_num_addrs
+-#define       icmp_wpa        icmp_hun.ih_rtradv.irt_wpa
+-#define       icmp_lifetime   icmp_hun.ih_rtradv.irt_lifetime
+-  union
+-  {
+-    struct
+-    {
+-      u_int32_t its_otime;
+-      u_int32_t its_rtime;
+-      u_int32_t its_ttime;
+-    } id_ts;
+-    struct
+-    {
+-      struct ip idi_ip;
+-      /* options and then 64 bits of data */
+-    } id_ip;
+-    struct icmp_ra_addr id_radv;
+-    u_int32_t   id_mask;
+-    u_int8_t    id_data[1];
+-  } icmp_dun;
+-#define       icmp_otime      icmp_dun.id_ts.its_otime
+-#define       icmp_rtime      icmp_dun.id_ts.its_rtime
+-#define       icmp_ttime      icmp_dun.id_ts.its_ttime
+-#define       icmp_ip         icmp_dun.id_ip.idi_ip
+-#define       icmp_radv       icmp_dun.id_radv
+-#define       icmp_mask       icmp_dun.id_mask
+-#define       icmp_data       icmp_dun.id_data
+-};
+-
+-/*
+- * Lower bounds on packet lengths for various types.
+- * For the error advice packets must first insure that the
+- * packet is large enough to contain the returned ip header.
+- * Only then can we do the check to see if 64 bits of packet
+- * data have been returned, since we need to check the returned
+- * ip header length.
+- */
+-#define       ICMP_MINLEN     8                               /* abs minimum */
+-#define       ICMP_TSLEN      (8 + 3 * sizeof (n_time))       /* timestamp */
+-#define       ICMP_MASKLEN    12                              /* address mask */
+-#define       ICMP_ADVLENMIN  (8 + sizeof (struct ip) + 8)    /* min */
+-#ifndef _IP_VHL
+-#define       ICMP_ADVLEN(p)  (8 + ((p)->icmp_ip.ip_hl << 2) + 8)
+-      /* N.B.: must separately check that ip_hl >= 5 */
+-#else
+-#define       ICMP_ADVLEN(p)  (8 + (IP_VHL_HL((p)->icmp_ip.ip_vhl) << 2) + 8)
+-      /* N.B.: must separately check that header length >= 5 */
+-#endif
+-
+-/* Definition of type and code fields. */
+-/* defined above: ICMP_ECHOREPLY, ICMP_REDIRECT, ICMP_ECHO */
+-#define       ICMP_UNREACH            3               /* dest unreachable, codes: */
+-#define       ICMP_SOURCEQUENCH       4               /* packet lost, slow down */
+-#define       ICMP_ROUTERADVERT       9               /* router advertisement */
+-#define       ICMP_ROUTERSOLICIT      10              /* router solicitation */
+-#define       ICMP_TIMXCEED           11              /* time exceeded, code: */
+-#define       ICMP_PARAMPROB          12              /* ip header bad */
+-#define       ICMP_TSTAMP             13              /* timestamp request */
+-#define       ICMP_TSTAMPREPLY        14              /* timestamp reply */
+-#define       ICMP_IREQ               15              /* information request */
+-#define       ICMP_IREQREPLY          16              /* information reply */
+-#define       ICMP_MASKREQ            17              /* address mask request */
+-#define       ICMP_MASKREPLY          18              /* address mask reply */
+-
+-#define       ICMP_MAXTYPE            18
+-
+-/* UNREACH codes */
+-#define       ICMP_UNREACH_NET                0       /* bad net */
+-#define       ICMP_UNREACH_HOST               1       /* bad host */
+-#define       ICMP_UNREACH_PROTOCOL           2       /* bad protocol */
+-#define       ICMP_UNREACH_PORT               3       /* bad port */
+-#define       ICMP_UNREACH_NEEDFRAG           4       /* IP_DF caused drop */
+-#define       ICMP_UNREACH_SRCFAIL            5       /* src route failed */
+-#define       ICMP_UNREACH_NET_UNKNOWN        6       /* unknown net */
+-#define       ICMP_UNREACH_HOST_UNKNOWN       7       /* unknown host */
+-#define       ICMP_UNREACH_ISOLATED           8       /* src host isolated */
+-#define       ICMP_UNREACH_NET_PROHIB         9       /* net denied */
+-#define       ICMP_UNREACH_HOST_PROHIB        10      /* host denied */
+-#define       ICMP_UNREACH_TOSNET             11      /* bad tos for net */
+-#define       ICMP_UNREACH_TOSHOST            12      /* bad tos for host */
+-#define       ICMP_UNREACH_FILTER_PROHIB      13      /* admin prohib */
+-#define       ICMP_UNREACH_HOST_PRECEDENCE    14      /* host prec vio. */
+-#define       ICMP_UNREACH_PRECEDENCE_CUTOFF  15      /* prec cutoff */
+-
+-/* REDIRECT codes */
+-#define       ICMP_REDIRECT_NET       0               /* for network */
+-#define       ICMP_REDIRECT_HOST      1               /* for host */
+-#define       ICMP_REDIRECT_TOSNET    2               /* for tos and net */
+-#define       ICMP_REDIRECT_TOSHOST   3               /* for tos and host */
+-
+-/* TIMEXCEED codes */
+-#define       ICMP_TIMXCEED_INTRANS   0               /* ttl==0 in transit */
+-#define       ICMP_TIMXCEED_REASS     1               /* ttl==0 in reass */
+-
+-/* PARAMPROB code */
+-#define       ICMP_PARAMPROB_OPTABSENT 1              /* req. opt. absent */
+-
+-#define       ICMP_INFOTYPE(type) \
+-      ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
+-      (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \
+-      (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
+-      (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
+-      (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
+-
+-#endif /* __USE_BSD */
+-
+-#endif /* netinet/ip_icmp.h */
+diff -durN orig/include-glibc/socketbits.h new/include-glibc/socketbits.h
+--- orig/include-glibc/socketbits.h    2005-11-14 22:37:26.000000000 +1100
++++ new/include-glibc/socketbits.h     1970-01-01 10:00:00.000000000 +1000
+@@ -1,280 +0,0 @@
+-/* System-specific socket constants and types.  Linux version.
+-   Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
+-   This file is part of the GNU C Library.
+-
+-   The GNU C Library is free software; you can redistribute it and/or
+-   modify it under the terms of the GNU Library General Public License as
+-   published by the Free Software Foundation; either version 2 of the
+-   License, or (at your option) any later version.
+-
+-   The GNU C Library is distributed in the hope that it will be useful,
+-   but WITHOUT ANY WARRANTY; without even the implied warranty of
+-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+-   Library General Public License for more details.
+-
+-   You should have received a copy of the GNU Library General Public
+-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+-   Boston, MA 02111-1307, USA.  */
+-
+-#ifndef       _SOCKETBITS_H
+-
+-#define       _SOCKETBITS_H   1
+-#include <features.h>
+-
+-#define       __need_size_t
+-#define __need_NULL
+-#include <stddef.h>
+-
+-
+-__BEGIN_DECLS
+-
+-/* Type for length arguments in socket calls.  */
+-#ifndef __socklen_t_defined
+-typedef unsigned int socklen_t;
+-# define __socklen_t_defined
+-#endif
+-
+-/* Types of sockets.  */
+-enum __socket_type
+-{
+-#ifndef __mips__
+-  SOCK_STREAM = 1,            /* Sequenced, reliable, connection-based
+-                                 byte streams.  */
+-#define SOCK_STREAM SOCK_STREAM
+-  SOCK_DGRAM = 2,             /* Connectionless, unreliable datagrams
+-                                 of fixed maximum length.  */
+-#define SOCK_DGRAM SOCK_DGRAM
+-#else
+-  SOCK_STREAM = 2,            /* Sequenced, reliable, connection-based
+-                                 byte streams.  */
+-#define SOCK_STREAM SOCK_STREAM
+-  SOCK_DGRAM = 1,             /* Connectionless, unreliable datagrams
+-                                 of fixed maximum length.  */
+-#define SOCK_DGRAM SOCK_DGRAM
+-#endif
+-  SOCK_RAW = 3,                       /* Raw protocol interface.  */
+-#define SOCK_RAW SOCK_RAW
+-  SOCK_RDM = 4,                       /* Reliably-delivered messages.  */
+-#define SOCK_RDM SOCK_RDM
+-  SOCK_SEQPACKET = 5,         /* Sequenced, reliable, connection-based,
+-                                 datagrams of fixed maximum length.  */
+-#define SOCK_SEQPACKET SOCK_SEQPACKET
+-  SOCK_PACKET = 10            /* Linux specific way of getting packets
+-                                 at the dev level.  For writing rarp and
+-                                 other similar things on the user level. */
+-#define SOCK_PACKET SOCK_PACKET
+-};
+-
+-/* Protocol families.  */
+-#define       PF_UNSPEC       0       /* Unspecified.  */
+-#define       PF_LOCAL        1       /* Local to host (pipes and file-domain).  */
+-#define       PF_UNIX         PF_LOCAL /* Old BSD name for PF_LOCAL.  */
+-#define       PF_FILE         PF_LOCAL /* POSIX name for PF_LOCAL.  */
+-#define       PF_INET         2       /* IP protocol family.  */
+-#define       PF_AX25         3       /* Amateur Radio AX.25.  */
+-#define       PF_IPX          4       /* Novell Internet Protocol.  */
+-#define       PF_APPLETALK    5       /* Don't use this.  */
+-#define       PF_NETROM       6       /* Amateur radio NetROM.  */
+-#define       PF_BRIDGE       7       /* Multiprotocol bridge.  */
+-#define       PF_AAL5         8       /* Reserved for Werner's ATM.  */
+-#define       PF_X25          9       /* Reserved for X.25 project.  */
+-#define       PF_INET6        10      /* IP version 6.  */
+-#define       PF_ROSE         11      /* Amateur Radio X.25 PLP       */
+-#define       PF_DECnet       12      /* Reserved for DECnet project  */
+-#define       PF_NETBEUI      13      /* Reserved for 802.2LLC project*/
+-#define       PF_SECURITY     14      /* Security callback pseudo AF */
+-#define       PF_KEY          15      /* PF_KEY key management API */
+-#define       PF_NETLINK      16
+-#define       PF_ROUTE        PF_NETLINK /* Alias to emulate 4.4BSD */
+-#define       PF_PACKET       17      /* Packet family                */
+-#define       PF_MAX          32      /* For now.. */
+-
+-/* Address families.  */
+-#define       AF_UNSPEC       PF_UNSPEC
+-#define       AF_LOCAL        PF_LOCAL
+-#define       AF_UNIX         PF_UNIX
+-#define       AF_FILE         PF_FILE
+-#define       AF_INET         PF_INET
+-#define       AF_AX25         PF_AX25
+-#define       AF_IPX          PF_IPX
+-#define       AF_APPLETALK    PF_APPLETALK
+-#define       AF_NETROM       PF_NETROM
+-#define       AF_BRIDGE       PF_BRIDGE
+-#define       AF_AAL5         PF_AAL5
+-#define       AF_X25          PF_X25
+-#define       AF_INET6        PF_INET6
+-#define       AF_ROSE         PF_ROSE
+-#define       AF_DECnet       PF_DECnet
+-#define       AF_NETBEUI      PF_NETBEUI
+-#define       AF_SECURITY     PF_SECURITY
+-#define       pseudo_AF_KEY   pseudo_PF_KEY
+-#define       AF_NETLINK      PF_NETLINK
+-#define       AF_ROUTE        PF_ROUTE
+-#define       AF_PACKET       PF_PACKET
+-#define       AF_MAX          PF_MAX
+-
+-/* Socket level values.  Others are defined in the appropriate headers.
+-
+-   XXX These definitions also should go into the appropriate headers as
+-   far as they are available.  */
+-#define SOL_IPV6        41
+-#define SOL_ICMPV6    58
+-#define SOL_RAW               255
+-#define SOL_AX25        257
+-#define SOL_ATALK     258
+-#define SOL_NETROM    259
+-#define SOL_ROSE      260
+-#define SOL_DECNET    261
+-#define SOL_X25               262
+-
+-/* Maximum queue length specifiable by listen.  */
+-#define SOMAXCONN     128
+-
+-/* Get the definition of the macro to define the common sockaddr members.  */
+-#if __GLIBC_MINOR__  >= 1
+-#include <bits/sockaddr.h>
+-#else
+-#include <sockaddrcom.h>
+-#endif
+-
+-/* Structure describing a generic socket address.  */
+-struct sockaddr
+-  {
+-    __SOCKADDR_COMMON (sa_);  /* Common data: address family and length.  */
+-    char sa_data[14];         /* Address data.  */
+-  };
+-
+-
+-/* Bits in the FLAGS argument to `send', `recv', et al.  */
+-enum
+-  {
+-    MSG_OOB           = 0x01, /* Process out-of-band data.  */
+-#define MSG_OOB               MSG_OOB
+-    MSG_PEEK          = 0x02, /* Peek at incoming messages.  */
+-#define MSG_PEEK      MSG_PEEK
+-    MSG_DONTROUTE     = 0x04, /* Don't use local routing.  */
+-#define MSG_DONTROUTE MSG_DONTROUTE
+-    MSG_CTRUNC                = 0x08, /* Control data lost before delivery.  */
+-#define MSG_CTRUNC    MSG_CTRUNC
+-    MSG_PROBE         = 0x10,
+-#define MSG_PROBE     MSG_PROBE
+-    MSG_TRUNC         = 0x20,
+-#define MSG_TRUNC     MSG_TRUNC
+-    MSG_DONTWAIT      = 0x40,
+-#define MSG_DONTWAIT  MSG_DONTWAIT
+-    MSG_WAITALL               = 0x100,
+-#define MSG_WAITALL   MSG_WAITALL
+-    MSG_CONFIRM               = 0x800,
+-#define MSG_CONFIRM   MSG_CONFIRM
+-    MSG_ERRQUEUE      = 0x2000,
+-#define MSG_ERRQUEUE  MSG_ERRQUEUE
+-    MSG_NOSIGNAL      = 0x4000,
+-#define MSG_NOSIGNAL  MSG_NOSIGNAL
+-  };
+-
+-/* Structure describing messages sent by
+-   `sendmsg' and received by `recvmsg'.  */
+-struct msghdr
+-  {
+-    __ptr_t msg_name;         /* Address to send to/receive from.  */
+-    socklen_t msg_namelen;    /* Length of address data.  */
+-
+-    struct iovec *msg_iov;    /* Vector of data to send/receive into.  */
+-    size_t msg_iovlen;                /* Number of elements in the vector.  */
+-
+-    __ptr_t msg_control;      /* Ancillary data (eg BSD filedesc passing). */
+-    size_t msg_controllen;    /* Ancillary data buffer length.  */
+-
+-    int msg_flags;            /* Flags on received message.  */
+-  };
+-
+-/* Structure used for storage of ancillary data object information.  */
+-struct cmsghdr
+-  {
+-    size_t cmsg_len;          /* Length of data in cmsg_data plus length
+-                                 of cmsghdr structure.  */
+-    int cmsg_level;           /* Originating protocol.  */
+-    int cmsg_type;            /* Protocol specific type.  */
+-#if !defined __STRICT_ANSI__ && defined __GNUC__ && __GNUC__ >= 2
+-    unsigned char __cmsg_data[0]; /* Ancillary data.  */
+-#endif
+-  };
+-
+-/* Ancillary data object manipulation macros.  */
+-#if !defined __STRICT_ANSI__ && defined __GNUC__ && __GNUC__ >= 2
+-# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
+-#else
+-# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
+-#endif
+-#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
+-#define CMSG_FIRSTHDR(mhdr) \
+-  ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr)               \
+-   ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL)
+-#define CMSG_ALIGN(len) ( ((len)+sizeof(long)-1) & ~(sizeof(long)-1) )
+-#define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len))
+-#define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
+-
+-
+-#ifndef _EXTERN_INLINE
+-# define _EXTERN_INLINE extern __inline
+-#endif
+-extern struct cmsghdr *__cmsg_nxthdr __P ((struct msghdr *__mhdr,
+-                                         struct cmsghdr *__cmsg));
+-_EXTERN_INLINE struct cmsghdr *
+-__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)
+-{
+-  if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
+-        /* The kernel header does this so there may be a reason.  */
+-        return NULL;
+-
+-  __cmsg = (struct cmsghdr *) 
+-        ((unsigned char *) __cmsg + CMSG_ALIGN(__cmsg->cmsg_len));  
+-
+-  if ( (unsigned char *) (__cmsg + 1) >= 
+-         (unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)
+-        /* No more entries.  */
+-        return NULL;
+-  return __cmsg;
+-}
+-
+-/* Socket level message types.  This must match the definitions in
+-   <linux/socket.h>.  */
+-enum
+-  {
+-    SCM_RIGHTS = 0x01,         /* Data array contains access rights.  */
+-#define SCM_RIGHTS SCM_RIGHTS
+-    SCM_CREDENTIALS = 0x02,  /* Data array is `struct ucred'.  */
+-#define SCM_CREDENTIALS SCM_CREDENTIALS
+-  };
+-
+-
+-
+-/* Get socket manipulation related informations from kernel headers.  */
+-#ifdef THIS_IS_CRAP
+-#ifndef _LINUX_TYPES_H
+-# define _LINUX_TYPES_H
+-#endif
+-#endif
+-
+-#include <asm/socket.h>
+-#include <asm/types.h>
+-
+-struct ucred
+-{
+-      __u32   pid;
+-      __u32   uid;
+-      __u32   gid;
+-};
+-
+-
+-/* Structure used to manipulate the SO_LINGER option.  */
+-struct linger
+-  {
+-    int l_onoff;              /* Nonzero to linger on close.  */
+-    int l_linger;             /* Time to linger.  */
+-  };
+-
+-__END_DECLS
+-
+-#endif /* socketbits.h */
diff --git a/packages/iputils/files/standard-header-types.patch b/packages/iputils/files/standard-header-types.patch
new file mode 100644 (file)
index 0000000..fac1ac6
--- /dev/null
@@ -0,0 +1,1072 @@
+Move away from using the linux specific headers and types and use the
+common glibc provided headers and types. Probably need to test this
+on uclibc / klibc at some stage as well.
+
+diff -durN orig/arping.c new/arping.c
+--- orig/arping.c      2005-11-14 22:38:27.000000000 +1100
++++ new/arping.c       2005-11-14 22:52:15.000000000 +1100
+@@ -12,13 +12,13 @@
+ #include <stdlib.h>
+ #include <sys/param.h>
+ #include <sys/socket.h>
+-#include <linux/sockios.h>
+ #include <sys/file.h>
+ #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 <net/ethernet.h>
+ #include <sys/uio.h>
+ #include <netdb.h>
+@@ -29,6 +29,7 @@
+ #include <string.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
++#include <netpacket/packet.h>
+ #include "SNAPSHOT.h"
+@@ -101,7 +102,7 @@
+       ah->ar_hrd = htons(ME->sll_hatype);
+       if (ah->ar_hrd == htons(ARPHRD_FDDI))
+               ah->ar_hrd = htons(ARPHRD_ETHER);
+-      ah->ar_pro = htons(ETH_P_IP);
++      ah->ar_pro = htons(ETHERTYPE_IP);
+       ah->ar_hln = ME->sll_halen;
+       ah->ar_pln = 4;
+       ah->ar_op  = advert ? htons(ARPOP_REPLY) : htons(ARPOP_REQUEST);
+@@ -213,7 +214,7 @@
+               return 0;
+       /* Protocol must be IP. */
+-      if (ah->ar_pro != htons(ETH_P_IP))
++      if (ah->ar_pro != htons(ETHERTYPE_IP))
+               return 0;
+       if (ah->ar_pln != 4)
+               return 0;
+@@ -434,7 +435,7 @@
+                       }
+               } else if (!dad) {
+                       int on = 1;
+-                      int alen = sizeof(saddr);
++                      unsigned int alen = sizeof(saddr);
+                       saddr.sin_port = htons(1025);
+                       saddr.sin_addr = dst;
+@@ -456,14 +457,14 @@
+       me.sll_family = AF_PACKET;
+       me.sll_ifindex = ifindex;
+-      me.sll_protocol = htons(ETH_P_ARP);
++      me.sll_protocol = htons(ETHERTYPE_ARP);
+       if (bind(s, (struct sockaddr*)&me, sizeof(me)) == -1) {
+               perror("bind");
+               exit(2);
+       }
+       if (1) {
+-              int alen = sizeof(me);
++              unsigned int alen = sizeof(me);
+               if (getsockname(s, (struct sockaddr*)&me, &alen) == -1) {
+                       perror("getsockname");
+                       exit(2);
+@@ -495,9 +496,9 @@
+       while(1) {
+               sigset_t sset, osset;
+-              char packet[4096];
++              unsigned char packet[4096];
+               struct sockaddr_ll from;
+-              int alen = sizeof(from);
++              unsigned int alen = sizeof(from);
+               int cc;
+               if ((cc = recvfrom(s, packet, sizeof(packet), 0,
+diff -durN orig/linux-errqueue.h new/linux-errqueue.h
+--- orig/linux-errqueue.h      1970-01-01 10:00:00.000000000 +1000
++++ new/linux-errqueue.h       2005-11-14 22:39:06.000000000 +1100
+@@ -0,0 +1,22 @@
++#ifndef LINUX_ERRQUEUE_H
++#define LINUX_ERRQUEUE_H 1
++
++struct sock_extended_err
++{
++      uint32_t        ee_errno;       
++      uint8_t         ee_origin;
++      uint8_t         ee_type;
++      uint8_t         ee_code;
++      uint8_t         ee_pad;
++      uint32_t        ee_info;
++      uint32_t        ee_data;
++};
++
++#define SO_EE_ORIGIN_NONE     0
++#define SO_EE_ORIGIN_LOCAL    1
++#define SO_EE_ORIGIN_ICMP     2
++#define SO_EE_ORIGIN_ICMP6    3
++
++#define SO_EE_OFFENDER(ee)    ((struct sockaddr*)((ee)+1))
++
++#endif
+diff -durN orig/ping6.c new/ping6.c
+--- orig/ping6.c       2005-11-14 22:38:28.000000000 +1100
++++ new/ping6.c        2005-11-14 22:39:06.000000000 +1100
+@@ -66,34 +66,19 @@
+  *    More statistics could always be gathered.
+  *    This program has to run SUID to ROOT to access the ICMP socket.
+  */
+-#include "ping_common.h"
+-
+-#include <linux/in6.h>
+-#include <linux/ipv6.h>
+-#include <linux/icmpv6.h>
+-
+-#define BIT_CLEAR(nr, addr) do { ((__u32 *)(addr))[(nr) >> 5] &= ~(1U << ((nr) & 31)); } while(0)
+-#define BIT_SET(nr, addr) do { ((__u32 *)(addr))[(nr) >> 5] |= (1U << ((nr) & 31)); } while(0)
+-#define BIT_TEST(nr, addr) do { (__u32 *)(addr))[(nr) >> 5] & (1U << ((nr) & 31)); } while(0)
+-
+-#define ICMPV6_FILTER_WILLPASS(type, filterp) \
+-      (BIT_TEST((type), filterp) == 0)
+-
+-#define ICMPV6_FILTER_WILLBLOCK(type, filterp) \
+-      BIT_TEST((type), filterp)
+-#define ICMPV6_FILTER_SETPASS(type, filterp) \
+-      BIT_CLEAR((type), filterp)
+-
+-#define ICMPV6_FILTER_SETBLOCK(type, filterp) \
+-      BIT_SET((type), filterp)
+-
+-#define ICMPV6_FILTER_SETPASSALL(filterp) \
+-      memset(filterp, 0, sizeof(struct icmp6_filter));
++#include "ping_common.h"
++#include <netinet/in.h>
++#include <netinet/ip6.h>
++#include <netinet/icmp6.h>
+-#define ICMPV6_FILTER_SETBLOCKALL(filterp) \
+-      memset(filterp, 0xFF, sizeof(struct icmp6_filter));
++/* define to specify we want type0 routing headers */
++#define IPV6_SRCRT_TYPE_0     0
++/* without this it won't link, seems like a hack to me ;( */
++#ifndef __constant_htons
++#define __constant_htons(x)  htons(x)
++#endif
+ #define       MAXPACKET       128000          /* max packet size */
+@@ -102,8 +87,8 @@
+ #endif
+-__u32 flowlabel;
+-__u32 tclass;
++uint32_t flowlabel;
++uint32_t tclass;
+ struct cmsghdr *srcrt;
+ struct sockaddr_in6 whereto;  /* who to ping */
+@@ -115,7 +100,7 @@
+ static char * pr_addr(struct in6_addr *addr);
+ static char * pr_addr_n(struct in6_addr *addr);
+-static int pr_icmph(__u8 type, __u8 code, __u32 info);
++static int pr_icmph(uint8_t type, uint8_t code, uint32_t info);
+ static void usage(void) __attribute((noreturn));
+ struct sockaddr_in6 source;
+@@ -137,7 +122,7 @@
+       if (type != 0 || segments > 24)
+               return 0;
+-      return (sizeof(struct cmsghdr) + sizeof(struct rt0_hdr) +
++      return (sizeof(struct cmsghdr) + sizeof(struct ip6_rthdr0) +
+               segments * sizeof(struct in6_addr));
+ }
+@@ -148,10 +133,10 @@
+       if (type)
+               return NULL;
+-      memset(bp, 0, sizeof(struct cmsghdr) + sizeof(struct rt0_hdr));
++      memset(bp, 0, sizeof(struct cmsghdr) + sizeof(struct ip6_rthdr0));
+       cmsg = (struct cmsghdr *) bp;
+-      cmsg->cmsg_len = sizeof(struct cmsghdr) + sizeof(struct rt0_hdr);
++      cmsg->cmsg_len = sizeof(struct cmsghdr) + sizeof(struct ip6_rthdr0);
+       cmsg->cmsg_level = SOL_IPV6;
+       cmsg->cmsg_type = IPV6_RTHDR;
+@@ -160,14 +145,14 @@
+ int inet6_srcrt_add(struct cmsghdr *cmsg, const struct in6_addr *addr)
+ {
+-      struct rt0_hdr *hdr;
++      struct ip6_rthdr0 *hdr;
+       
+-      hdr = (struct rt0_hdr *) CMSG_DATA(cmsg);
++      hdr = (struct ip6_rthdr0 *) CMSG_DATA(cmsg);
+       cmsg->cmsg_len += sizeof(struct in6_addr);
+-      hdr->rt_hdr.hdrlen += sizeof(struct in6_addr) / 8;
++      hdr->ip6r0_len += sizeof(struct in6_addr) / 8;
+-      memcpy(&hdr->addr[hdr->rt_hdr.segments_left++], addr,
++      memcpy(&hdr->ip6r0_addr[hdr->ip6r0_segleft++], addr,
+              sizeof(struct in6_addr));
+               
+       return 0;
+@@ -313,7 +298,7 @@
+       hostname = target;
+       if (ipv6_addr_any(&source.sin6_addr)) {
+-              int alen;
++              unsigned int alen;
+               int probe_fd = socket(AF_INET6, SOCK_DGRAM, 0);
+               if (probe_fd < 0) {
+@@ -440,22 +425,22 @@
+       /*
+        *      select icmp echo reply as icmp type to receive
+        */
+-      ICMPV6_FILTER_SETBLOCKALL(&filter);
++      ICMP6_FILTER_SETBLOCKALL(&filter);
+       if (!working_recverr) {
+-              ICMPV6_FILTER_SETPASS(ICMPV6_DEST_UNREACH, &filter);
+-              ICMPV6_FILTER_SETPASS(ICMPV6_PKT_TOOBIG, &filter);
+-              ICMPV6_FILTER_SETPASS(ICMPV6_TIME_EXCEED, &filter);
+-              ICMPV6_FILTER_SETPASS(ICMPV6_PARAMPROB, &filter);
++              ICMP6_FILTER_SETPASS(ICMP6_DST_UNREACH, &filter);
++              ICMP6_FILTER_SETPASS(ICMP6_PACKET_TOO_BIG, &filter);
++              ICMP6_FILTER_SETPASS(ICMP6_TIME_EXCEEDED, &filter);
++              ICMP6_FILTER_SETPASS(ICMP6_PARAM_PROB, &filter);
+       }
+-      ICMPV6_FILTER_SETPASS(ICMPV6_ECHO_REPLY, &filter);
++      ICMP6_FILTER_SETPASS(ICMP6_ECHO_REPLY, &filter);
+-      err = setsockopt(icmp_sock, SOL_ICMPV6, ICMPV6_FILTER, &filter,
++      err = setsockopt(icmp_sock, SOL_ICMPV6, ICMP6_FILTER, &filter,
+                        sizeof(struct icmp6_filter));
+       if (err < 0) {
+-              perror("setsockopt(ICMPV6_FILTER)");
++              perror("setsockopt(ICMP6_FILTER)");
+               exit(2);
+       }
+@@ -556,7 +541,7 @@
+       struct msghdr msg;
+       struct cmsghdr *cmsg;
+       struct sock_extended_err *e;
+-      struct icmp6hdr icmph;
++      struct icmp6_hdr icmph;
+       struct sockaddr_in6 target;
+       int net_errors = 0;
+       int local_errors = 0;
+@@ -602,8 +587,8 @@
+               if (res < sizeof(icmph) ||
+                   memcmp(&target.sin6_addr, &whereto.sin6_addr, 16) ||
+-                  icmph.icmp6_type != ICMPV6_ECHO_REQUEST ||
+-                  icmph.icmp6_identifier != ident) {
++                  icmph.icmp6_type != ICMP6_ECHO_REQUEST ||
++                  icmph.icmp6_id != ident) {
+                       /* Not our error, not an error at all. Clear. */
+                       saved_errno = 0;
+                       goto out;
+@@ -616,7 +601,7 @@
+               if (options & F_FLOOD) {
+                       write(STDOUT_FILENO, "\bE", 2);
+               } else {
+-                      printf("From %s icmp_seq=%u ", pr_addr(&sin6->sin6_addr), ntohs(icmph.icmp6_sequence));
++                      printf("From %s icmp_seq=%u ", pr_addr(&sin6->sin6_addr), ntohs(icmph.icmp6_seq));
+                       pr_icmph(e->ee_type, e->ee_code, e->ee_info);
+                       putchar('\n');
+                       fflush(stdout);
+@@ -638,16 +623,16 @@
+  */
+ int send_probe(void)
+ {
+-      struct icmp6hdr *icmph;
++      struct icmp6_hdr *icmph;
+       int cc;
+       int i;
+-      icmph = (struct icmp6hdr *)outpack;
+-      icmph->icmp6_type = ICMPV6_ECHO_REQUEST;
++      icmph = (struct icmp6_hdr *)outpack;
++      icmph->icmp6_type = ICMP6_ECHO_REQUEST;
+       icmph->icmp6_code = 0;
+       icmph->icmp6_cksum = 0;
+-      icmph->icmp6_sequence = htons(ntransmitted+1);
+-      icmph->icmp6_identifier = ident;
++      icmph->icmp6_seq = htons(ntransmitted+1);
++      icmph->icmp6_id = ident;
+       CLR((ntransmitted+1) % mx_dup_ck);
+@@ -693,9 +678,9 @@
+ parse_reply(struct msghdr *msg, int cc, void *addr, struct timeval *tv)
+ {
+       struct sockaddr_in6 *from = addr;
+-      __u8 *buf = msg->msg_iov->iov_base;
++      uint8_t *buf = msg->msg_iov->iov_base;
+       struct cmsghdr *c;
+-      struct icmp6hdr *icmph;
++      struct icmp6_hdr *icmph;
+       int hops = -1;
+       for (c = CMSG_FIRSTHDR(msg); c; c = CMSG_NXTHDR(msg, c)) {
+@@ -710,24 +695,24 @@
+       /* Now the ICMP part */
+-      icmph = (struct icmp6hdr *) buf;
++      icmph = (struct icmp6_hdr *) buf;
+       if (cc < 8) {
+               if (options & F_VERBOSE)
+                       fprintf(stderr, "ping: packet too short (%d bytes)\n", cc);
+               return 1;
+       }
+-      if (icmph->icmp6_type == ICMPV6_ECHO_REPLY) {
+-              if (icmph->icmp6_identifier != ident)
++      if (icmph->icmp6_type == ICMP6_ECHO_REPLY) {
++              if (icmph->icmp6_id != ident)
+                       return 1;
+-              if (gather_statistics((__u8*)(icmph+1), cc,
+-                                    ntohs(icmph->icmp6_sequence),
++              if (gather_statistics((uint8_t*)(icmph+1), cc,
++                                    ntohs(icmph->icmp6_seq),
+                                     hops, 0, tv, pr_addr(&from->sin6_addr)))
+                       return 0;
+       } else {
+               int nexthdr;
+-              struct ipv6hdr *iph1 = (struct ipv6hdr*)(icmph+1);
+-              struct icmp6hdr *icmph1 = (struct icmp6hdr *)(iph1+1);
++              struct ip6_hdr *iph1 = (struct ip6_hdr*)(icmph+1);
++              struct icmp6_hdr *icmph1 = (struct icmp6_hdr *)(iph1+1);
+               /* We must not ever fall here. All the messages but
+                * echo reply are blocked by filter and error are
+@@ -736,23 +721,23 @@
+                * using RECVRERR. :-)
+                */
+-              if (cc < 8+sizeof(struct ipv6hdr)+8)
++              if (cc < 8+sizeof(struct ip6_hdr)+8)
+                       return 1;
+-              if (memcmp(&iph1->daddr, &whereto.sin6_addr, 16))
++              if (memcmp(&iph1->ip6_dst, &whereto.sin6_addr, 16))
+                       return 1;
+-              nexthdr = iph1->nexthdr;
++              nexthdr = iph1->ip6_nxt;
+               if (nexthdr == 44) {
+-                      nexthdr = *(__u8*)icmph1;
++                      nexthdr = *(uint8_t*)icmph1;
+                       icmph1++;
+               }
+               if (nexthdr == IPPROTO_ICMPV6) {
+-                      if (icmph1->icmp6_type != ICMPV6_ECHO_REQUEST ||
+-                          icmph1->icmp6_identifier != ident)
++                      if (icmph1->icmp6_type != ICMP6_ECHO_REQUEST ||
++                          icmph1->icmp6_id != ident)
+                               return 1;
+-                      acknowledge(ntohs(icmph1->icmp6_sequence));
++                      acknowledge(ntohs(icmph1->icmp6_seq));
+                       if (working_recverr)
+                               return 0;
+                       nerrors++;
+@@ -760,7 +745,7 @@
+                               write(STDOUT_FILENO, "\bE", 2);
+                               return 0;
+                       }
+-                      printf("From %s: icmp_seq=%u ", pr_addr(&from->sin6_addr), ntohs(icmph1->icmp6_sequence));
++                      printf("From %s: icmp_seq=%u ", pr_addr(&from->sin6_addr), ntohs(icmph1->icmp6_seq));
+               } else {
+                       /* We've got something other than an ECHOREPLY */
+                       if (!(options & F_VERBOSE) || uid)
+@@ -780,25 +765,25 @@
+ }
+-int pr_icmph(__u8 type, __u8 code, __u32 info)
++int pr_icmph(uint8_t type, uint8_t code, uint32_t info)
+ {
+       switch(type) {
+-      case ICMPV6_DEST_UNREACH:
++      case ICMP6_DST_UNREACH:
+               printf("Destination unreachable: ");
+               switch (code) {
+-              case ICMPV6_NOROUTE:
++              case ICMP6_DST_UNREACH_NOROUTE:
+                       printf("No route");
+                       break;
+-              case ICMPV6_ADM_PROHIBITED:
++              case ICMP6_DST_UNREACH_ADMIN:
+                       printf("Administratively prohibited");
+                       break;
+-              case ICMPV6_NOT_NEIGHBOUR:
++              case ICMP6_DST_UNREACH_NOTNEIGHBOR:
+                       printf("Not neighbour");
+                       break;
+-              case ICMPV6_ADDR_UNREACH:
++              case ICMP6_DST_UNREACH_ADDR:
+                       printf("Address unreachable");
+                       break;
+-              case ICMPV6_PORT_UNREACH:
++              case ICMP6_DST_UNREACH_NOPORT:
+                       printf("Port unreachable");
+                       break;
+               default:        
+@@ -806,45 +791,45 @@
+                       break;
+               }
+               break;
+-      case ICMPV6_PKT_TOOBIG:
++      case ICMP6_PACKET_TOO_BIG:
+               printf("Packet too big: mtu=%u", info);
+               if (code)
+                       printf(", code=%d", code);
+               break;
+-      case ICMPV6_TIME_EXCEED:
++      case ICMP6_TIME_EXCEEDED:
+               printf("Time exceeded: ");
+-              if (code == ICMPV6_EXC_HOPLIMIT)
++              if (code == ICMP6_TIME_EXCEED_TRANSIT)
+                       printf("Hop limit");
+-              else if (code == ICMPV6_EXC_FRAGTIME)
++              else if (code == ICMP6_TIME_EXCEED_REASSEMBLY)
+                       printf("Defragmentation failure");
+               else
+                       printf("code %d", code);
+               break;
+-      case ICMPV6_PARAMPROB:
++      case ICMP6_PARAM_PROB:
+               printf("Parameter problem: ");
+-              if (code == ICMPV6_HDR_FIELD)
++              if (code == ICMP6_PARAMPROB_HEADER)
+                       printf("Wrong header field ");
+-              else if (code == ICMPV6_UNK_NEXTHDR)
++              else if (code == ICMP6_PARAMPROB_NEXTHEADER)
+                       printf("Unknown header ");
+-              else if (code == ICMPV6_UNK_OPTION)
++              else if (code == ICMP6_PARAMPROB_OPTION)
+                       printf("Unknown option ");
+               else
+                       printf("code %d ", code);
+               printf ("at %u", info);
+               break;
+-      case ICMPV6_ECHO_REQUEST:
++      case ICMP6_ECHO_REQUEST:
+               printf("Echo request");
+               break;
+-      case ICMPV6_ECHO_REPLY:
++      case ICMP6_ECHO_REPLY:
+               printf("Echo reply");
+               break;
+-      case ICMPV6_MGM_QUERY:
++      case ICMP6_MEMBERSHIP_QUERY:
+               printf("MLD Query");
+               break;
+-      case ICMPV6_MGM_REPORT:
++      case ICMP6_MEMBERSHIP_REPORT:
+               printf("MLD Report");
+               break;
+-      case ICMPV6_MGM_REDUCTION:
++      case ICMP6_MEMBERSHIP_REDUCTION:
+               printf("MLD Reduction");
+               break;
+       default:
+@@ -856,6 +841,7 @@
+ #include <linux/filter.h>
++
+ void install_filter(void)
+ {
+       static int once;
+@@ -864,7 +850,7 @@
+               BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, 0xAAAA, 0, 1),  /* Ours? */
+               BPF_STMT(BPF_RET|BPF_K, ~0U),  /* Yes, it passes. */
+               BPF_STMT(BPF_LD|BPF_B|BPF_ABS, 0),  /* Load icmp type */
+-              BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, ICMPV6_ECHO_REPLY, 1, 0), /* Echo? */
++              BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, ICMP6_ECHO_REPLY, 1, 0), /* Echo? */
+               BPF_STMT(BPF_RET|BPF_K, ~0U), /* No. It passes. This must not happen. */
+               BPF_STMT(BPF_RET|BPF_K, 0), /* Echo with wrong ident. Reject. */
+       };
+@@ -895,7 +881,7 @@
+       struct hostent *hp = NULL;
+       if (!(options&F_NUMERIC))
+-              hp = gethostbyaddr((__u8*)addr, sizeof(struct in6_addr), AF_INET6);
++              hp = gethostbyaddr((uint8_t*)addr, sizeof(struct in6_addr), AF_INET6);
+       return hp ? hp->h_name : pr_addr_n(addr);
+ }
+diff -durN orig/ping.c new/ping.c
+--- orig/ping.c        2005-11-14 22:38:28.000000000 +1100
++++ new/ping.c 2005-11-14 22:39:06.000000000 +1100
+@@ -57,12 +57,21 @@
+  *    More statistics could always be gathered.
+  *    This program has to run SUID to ROOT to access the ICMP socket.
+  */
+-
+ #include "ping_common.h"
+ #include <netinet/ip.h>
+ #include <netinet/ip_icmp.h>
++/* from linux/icmp.h */
++#define ICMP_FILTER                     1
++struct icmp_filter {
++      uint32_t data;
++};
++
++/* without this it won't link, seems like a hack to me ;( */
++#ifndef __constant_htons
++#define __constant_htons(x)  htons(x)
++#endif
+ #define       MAXIPLEN        60
+ #define       MAXICMPLEN      76
+@@ -72,7 +81,7 @@
+ static int ts_type;
+ static int nroute = 0;
+-static __u32 route[10];
++static uint32_t route[10];
+@@ -85,12 +94,12 @@
+ static int broadcast_pings = 0;
+-static char *pr_addr(__u32);
++static char *pr_addr(uint32_t);
+ static void pr_options(unsigned char * cp, int hlen);
+ static void pr_iph(struct iphdr *ip);
+ static void usage(void) __attribute__((noreturn));
+ 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 void pr_icmph(uint8_t type, uint8_t code, uint32_t info, struct icmphdr *icp);
+ static int parsetos(char *str);
+ static struct {
+@@ -169,8 +178,8 @@
+                       if (sscanf(optarg, "%u.%u.%u.%u%c",
+                                  &i1, &i2, &i3, &i4, &dummy) == 4) {
+-                              __u8 *ptr;
+-                              ptr = (__u8*)&source.sin_addr;
++                              uint8_t *ptr;
++                              ptr = (uint8_t*)&source.sin_addr;
+                               ptr[0] = i1;
+                               ptr[1] = i2;
+                               ptr[2] = i3;
+@@ -249,7 +258,7 @@
+       }
+       if (source.sin_addr.s_addr == 0) {
+-              int alen;
++              unsigned int alen;
+               struct sockaddr_in dst = whereto;
+               int probe_fd = socket(AF_INET, SOCK_DGRAM, 0);
+@@ -409,7 +418,7 @@
+                       int i;
+                       rspace[1] = 4+nroute*8;
+                       for (i=0; i<nroute; i++)
+-                              *(__u32*)&rspace[4+i*8] = route[i];
++                              *(uint32_t*)&rspace[4+i*8] = route[i];
+               }
+               if (setsockopt(icmp_sock, IPPROTO_IP, IP_OPTIONS, rspace, rspace[1]) < 0) {
+                       rspace[3] = 2;
+@@ -429,7 +438,7 @@
+               rspace[1+IPOPT_OLEN] = 3 + nroute*4;
+               rspace[1+IPOPT_OFFSET] = IPOPT_MINOFF;
+               for (i=0; i<nroute; i++)
+-                      *(__u32*)&rspace[4+i*4] = route[i];
++                      *(uint32_t*)&rspace[4+i*4] = route[i];
+               
+               if (setsockopt(icmp_sock, IPPROTO_IP, IP_OPTIONS, rspace, 4 + nroute*4) < 0) {
+                       perror("ping: record route");
+@@ -670,7 +679,7 @@
+ parse_reply(struct msghdr *msg, int cc, void *addr, struct timeval *tv)
+ {
+       struct sockaddr_in *from = addr;
+-      __u8 *buf = msg->msg_iov->iov_base;
++      uint8_t *buf = msg->msg_iov->iov_base;
+       struct icmphdr *icp;
+       struct iphdr *ip;
+       int hlen;
+@@ -694,7 +703,7 @@
+       if (icp->type == ICMP_ECHOREPLY) {
+               if (icp->un.echo.id != ident)
+                       return 1;                       /* 'Twas not our ECHO */
+-              if (gather_statistics((__u8*)(icp+1), cc,
++              if (gather_statistics((uint8_t*)(icp+1), cc,
+                                     ntohs(icp->un.echo.sequence),
+                                     ip->ttl, 0, tv, pr_addr(from->sin_addr.s_addr)))
+                       return 0;
+@@ -826,7 +835,7 @@
+  * pr_icmph --
+  *    Print a descriptive string about an ICMP header.
+  */
+-void pr_icmph(__u8 type, __u8 code, __u32 info, struct icmphdr *icp)
++void pr_icmph(uint8_t type, uint8_t code, uint32_t info, struct icmphdr *icp)
+ {
+       switch(type) {
+       case ICMP_ECHOREPLY:
+@@ -1008,7 +1017,7 @@
+                       cp++;
+                       if (j > IPOPT_MINOFF) {
+                               for (;;) {
+-                                      __u32 address;
++                                      uint32_t address;
+                                       memcpy(&address, cp, 4);
+                                       cp += 4;
+                                       if (address == 0)
+@@ -1043,7 +1052,7 @@
+                       printf("\nRR: ");
+                       cp++;
+                       for (;;) {
+-                              __u32 address;
++                              uint32_t address;
+                               memcpy(&address, cp, 4);
+                               cp += 4;
+                               if (address == 0)
+@@ -1059,7 +1068,7 @@
+               case IPOPT_TS:
+               {
+                       int stdtime = 0, nonstdtime = 0;
+-                      __u8 flags;
++                      uint8_t flags;
+                       j = *++cp;              /* get length */
+                       i = *++cp;              /* and pointer */
+                       if (i > j)
+@@ -1074,7 +1083,7 @@
+                               long l;
+                               if ((flags&0xF) != IPOPT_TS_TSONLY) {
+-                                      __u32 address;
++                                      uint32_t address;
+                                       memcpy(&address, cp, 4);
+                                       cp += 4;
+                                       if (address == 0)
+@@ -1152,7 +1161,7 @@
+  * a hostname.
+  */
+ char *
+-pr_addr(__u32 addr)
++pr_addr(uint32_t addr)
+ {
+       struct hostent *hp;
+       static char buf[4096];
+diff -durN orig/ping_common.c new/ping_common.c
+--- orig/ping_common.c 2005-11-14 22:38:28.000000000 +1100
++++ new/ping_common.c  2005-11-14 22:39:06.000000000 +1100
+@@ -8,7 +8,7 @@
+ int ttl;
+ int rtt;
+ int rtt_addend;
+-__u16 acked;
++uint16_t acked;
+ int mx_dup_ck = MAX_DUP_CHK;
+ char rcvd_tbl[MAX_DUP_CHK / 8];
+@@ -62,12 +62,12 @@
+ /* Fills all the outpack, excluding ICMP header, but _including_
+  * timestamp area with supplied pattern.
+  */
+-static void fill(char *patp)
++static void fill(unsigned char *patp)
+ {
+       int ii, jj, kk;
+       int pat[16];
+-      char *cp;
+-      char *bp = outpack+8;
++      unsigned char *cp;
++      unsigned char *bp = outpack+8;
+       for (cp = patp; *cp; cp++) {
+               if (!isxdigit(*cp)) {
+@@ -76,7 +76,7 @@
+                       exit(2);
+               }
+       }
+-      ii = sscanf(patp,
++      ii = sscanf((char*)patp,
+           "%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x",
+           &pat[0], &pat[1], &pat[2], &pat[3], &pat[4], &pat[5], &pat[6],
+           &pat[7], &pat[8], &pat[9], &pat[10], &pat[11], &pat[12],
+@@ -173,7 +173,7 @@
+               break;
+       case 'p':               /* fill buffer with user pattern */
+               options |= F_PINGFILLED;
+-              fill(optarg);
++              fill((unsigned char*)optarg);
+               break;
+       case 'q':
+               options |= F_QUIET;
+@@ -393,7 +393,7 @@
+ void sock_setbufs(int icmp_sock, int alloc)
+ {
+       int rcvbuf, hold;
+-      int tmplen = sizeof(hold);
++      unsigned int tmplen = sizeof(hold);
+       if (!sndbuf)
+               sndbuf = alloc;
+@@ -466,7 +466,7 @@
+       if (!(options & F_PINGFILLED)) {
+               int i;
+-              char *p = outpack+8;
++              unsigned char *p = outpack+8;
+               /* Do not forget about case of small datalen,
+                * fill timestamp area too!
+@@ -503,7 +503,7 @@
+       }
+ }
+-void main_loop(int icmp_sock, __u8 *packet, int packlen)
++void main_loop(int icmp_sock, uint8_t *packet, int packlen)
+ {
+       char addrbuf[128];
+       char ans_data[4096];
+@@ -646,7 +646,7 @@
+       finish();
+ }
+-int gather_statistics(__u8 *ptr, int cc, __u16 seq, int hops,
++int gather_statistics(uint8_t *ptr, int cc, uint16_t seq, int hops,
+                     int csfailed, struct timeval *tv, char *from)
+ {
+       int dupflag = 0;
+@@ -711,7 +711,7 @@
+                       write(STDOUT_FILENO, "\bC", 1);
+       } else {
+               int i;
+-              __u8 *cp, *dp;
++              uint8_t *cp, *dp;
+               printf("%d bytes from %s: icmp_seq=%u", cc, from, seq);
+               if (hops >= 0)
+diff -durN orig/ping_common.h new/ping_common.h
+--- orig/ping_common.h 2005-11-14 22:38:28.000000000 +1100
++++ new/ping_common.h  2005-11-14 22:39:06.000000000 +1100
+@@ -4,7 +4,6 @@
+ #include <time.h>
+ #include <sys/param.h>
+ #include <sys/socket.h>
+-#include <linux/sockios.h>
+ #include <sys/file.h>
+ #include <sys/time.h>
+ #include <sys/signal.h>
+@@ -16,9 +15,9 @@
+ #include <errno.h>
+ #include <string.h>
+ #include <netdb.h>
+-
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
++#include <linux/types.h>
+ #include <linux/errqueue.h>
+ #include "SNAPSHOT.h"
+@@ -109,7 +108,7 @@
+ extern long long tsum;                        /* sum of all times, for doing average */
+ extern long long tsum2;
+ extern int rtt;
+-extern __u16 acked;
++extern uint16_t acked;
+ extern int pipesize;
+ #define COMMON_OPTIONS \
+@@ -160,18 +159,18 @@
+ static inline int in_flight(void)
+ {
+-      __u16 diff = (__u16)ntransmitted - acked;
++      uint16_t diff = (uint16_t)ntransmitted - acked;
+       return (diff<=0x7FFF) ? diff : ntransmitted-nreceived-nerrors;
+ }
+-static inline void acknowledge(__u16 seq)
++static inline void acknowledge(uint16_t seq)
+ { 
+-      __u16 diff = (__u16)ntransmitted - seq;
++      uint16_t diff = (uint16_t)ntransmitted - seq;
+       if (diff <= 0x7FFF) {
+               if ((int)diff+1 > pipesize)
+                       pipesize = (int)diff+1;
+-              if ((__s16)(seq - acked) > 0 ||
+-                  (__u16)ntransmitted - acked > 0x7FFF)
++              if ((int16_t)(seq - acked) > 0 ||
++                  (uint16_t)ntransmitted - acked > 0x7FFF)
+                       acked = seq;
+       }
+ }
+@@ -180,8 +179,8 @@
+ {
+       ntransmitted++;
+       /* Invalidate acked, if 16 bit seq overflows. */
+-      if ((__u16)ntransmitted - acked > 0x7FFF)
+-              acked = (__u16)ntransmitted + 1;
++      if ((uint16_t)ntransmitted - acked > 0x7FFF)
++              acked = (uint16_t)ntransmitted + 1;
+ }
+@@ -193,9 +192,9 @@
+ extern int pinger(void);
+ extern void sock_setbufs(int icmp_sock, int alloc);
+ extern void setup(int icmp_sock);
+-extern void main_loop(int icmp_sock, __u8 *buf, int buflen) __attribute__((noreturn));
++extern void main_loop(int icmp_sock, uint8_t *buf, int buflen) __attribute__((noreturn));
+ extern void finish(void) __attribute__((noreturn));
+ extern void status(void);
+ extern void common_options(int ch);
+-extern int gather_statistics(__u8 *ptr, int cc, __u16 seq, int hops,
++extern int gather_statistics(uint8_t *ptr, int cc, uint16_t seq, int hops,
+                            int csfailed, struct timeval *tv, char *from);
+diff -durN orig/tracepath6.c new/tracepath6.c
+--- orig/tracepath6.c  2005-11-14 22:38:28.000000000 +1100
++++ new/tracepath6.c   2005-11-14 22:39:54.000000000 +1100
+@@ -14,16 +14,14 @@
+ #include <unistd.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+-
+-#include <linux/in6.h>
+-#include <linux/errqueue.h>
+ #include <errno.h>
+ #include <string.h>
+ #include <netdb.h>
+ #include <resolv.h>
+ #include <sys/time.h>
+-#include <sys/uio.h>
++#include <sys/types.h>
+ #include <arpa/inet.h>
++#include "linux-errqueue.h"
+ int overhead = 48;
+ int mtu = 128000;
+@@ -35,7 +33,7 @@
+ struct probehdr
+ {
+-      __u32 ttl;
++      uint32_t ttl;
+       struct timeval tv;
+ };
+@@ -116,7 +114,7 @@
+                       }
+               } else if (cmsg->cmsg_level == SOL_IP) {
+                       if (cmsg->cmsg_type == IP_TTL) {
+-                              rethops = *(__u8*)CMSG_DATA(cmsg);
++                              rethops = *(uint8_t*)CMSG_DATA(cmsg);
+                       }
+               }
+       }
+diff -durN orig/tracepath.c new/tracepath.c
+--- orig/tracepath.c   2005-11-14 22:38:28.000000000 +1100
++++ new/tracepath.c    2005-11-14 22:39:06.000000000 +1100
+@@ -13,7 +13,6 @@
+ #include <stdlib.h>
+ #include <unistd.h>
+ #include <sys/socket.h>
+-#include <linux/errqueue.h>
+ #include <errno.h>
+ #include <string.h>
+ #include <netdb.h>
+@@ -22,6 +21,7 @@
+ #include <sys/time.h>
+ #include <sys/uio.h>
+ #include <arpa/inet.h>
++#include "linux-errqueue.h"
+ struct hhistory
+ {
+@@ -33,7 +33,7 @@
+ int hisptr;
+ struct sockaddr_in target;
+-__u16 base_port;
++uint16_t base_port;
+ const int overhead = 28;
+ int mtu = 65535;
+@@ -43,7 +43,7 @@
+ struct probehdr
+ {
+-      __u32 ttl;
++      uint32_t ttl;
+       struct timeval tv;
+ };
+@@ -80,7 +80,7 @@
+       memset(&rcvbuf, -1, sizeof(rcvbuf));
+       iov.iov_base = &rcvbuf;
+       iov.iov_len = sizeof(rcvbuf);
+-      msg.msg_name = (__u8*)&addr;
++      msg.msg_name = (uint8_t*)&addr;
+       msg.msg_namelen = sizeof(addr);
+       msg.msg_iov = &iov;
+       msg.msg_iovlen = 1;
+diff -durN orig/traceroute6.c new/traceroute6.c
+--- orig/traceroute6.c 2005-11-14 22:38:28.000000000 +1100
++++ new/traceroute6.c  2005-11-14 22:40:56.000000000 +1100
+@@ -245,11 +245,8 @@
+ #include <netinet/ip.h>
+ #include <netinet/ip_icmp.h>
+ #include <netinet/udp.h>
+-
+-#include <linux/ipv6.h>
+-#include <linux/in6.h>
+-
+-#include <linux/icmpv6.h>
++#include <netinet/icmp6.h>
++#include <netinet/ip6.h>
+ #include <arpa/inet.h>
+@@ -314,8 +311,8 @@
+ struct pkt_format
+ {
+-      __u32 ident;
+-      __u32 seq;
++      uint32_t ident;
++      uint32_t seq;
+       struct timeval tv;
+ };
+@@ -497,7 +494,7 @@
+                                 (char *)&on, sizeof(on));
+       if (source == NULL) {
+-              int alen;
++              unsigned int alen;
+               int probe_fd = socket(AF_INET6, SOCK_DGRAM, 0);
+               if (probe_fd < 0) {
+@@ -574,20 +571,20 @@
+                                       }
+                                       Printf("  %g ms", deltaT(&t1, &t2));
+                                       switch(i - 1) {
+-                                      case ICMPV6_PORT_UNREACH:
++                                      case ICMP6_DST_UNREACH_NOPORT:
+                                               ++got_there;
+                                               break;
+-                                      case ICMPV6_NOROUTE:
++                                      case ICMP6_DST_UNREACH_NOROUTE:
+                                               ++unreachable;
+                                               Printf(" !N");
+                                               break;
+-                                      case ICMPV6_ADDR_UNREACH:
++                                      case ICMP6_DST_UNREACH_ADDR:
+                                               ++unreachable;
+                                               Printf(" !H");
+                                               break;
+-                                      case ICMPV6_ADM_PROHIBITED:
++                                      case ICMP6_DST_UNREACH_ADMIN:
+                                               ++unreachable;
+                                               Printf(" !S");
+                                               break;
+@@ -618,7 +615,7 @@
+       fd_set fds;
+       static struct timeval wait;
+       int cc = 0;
+-      int fromlen = sizeof (*from);
++      unsigned int fromlen = sizeof (*from);
+       FD_ZERO(&fds);
+       FD_SET(sock, &fds);
+@@ -727,24 +724,24 @@
+ int packet_ok(u_char *buf, int cc, struct sockaddr_in6 *from, int seq,
+             struct timeval *tv)
+ {
+-      struct icmp6hdr *icp;
++      struct icmp6_hdr *icp;
+       u_char type, code;
+-      icp = (struct icmp6hdr *) buf;
++      icp = (struct icmp6_hdr *) buf;
+       type = icp->icmp6_type;
+       code = icp->icmp6_code;
+-      if ((type == ICMPV6_TIME_EXCEED && code == ICMPV6_EXC_HOPLIMIT) ||
+-          type == ICMPV6_DEST_UNREACH)
++      if ((type == ICMP6_TIME_EXCEEDED && code == ICMP6_TIME_EXCEED_TRANSIT) ||
++          type == ICMP6_DST_UNREACH)
+       {
+-              struct ipv6hdr *hip;
++              struct ip6_hdr *hip;
+               struct udphdr *up;
+               int nexthdr;
+-              hip = (struct ipv6hdr *) (icp + 1);
++              hip = (struct ip6_hdr *) (icp + 1);
+               up = (struct udphdr *)(hip+1);
+-              nexthdr = hip->nexthdr;
++              nexthdr = hip->ip6_nxt;
+               if (nexthdr == 44) {
+                       nexthdr = *(unsigned char*)up;
+@@ -760,29 +757,29 @@
+                           ntohl(pkt->seq) == seq)
+                       {
+                               *tv = pkt->tv;
+-                              return (type == ICMPV6_TIME_EXCEED? -1 : code+1);
++                              return (type == ICMP6_TIME_EXCEEDED? -1 : code+1);
+                       }
+               }
+       }
+       if (verbose) {
+-              struct ipv6hdr *hip;
+-              __u32 *lp;
++              struct ip6_hdr *hip;
++              uint32_t *lp;
+               char pa1[MAXHOSTNAMELEN];
+               char pa2[MAXHOSTNAMELEN];
+               int i;
+-              hip = (struct ipv6hdr *) (icp + 1);
+-              lp = (__u32 *) (icp + 1);
++              hip = (struct ip6_hdr *) (icp + 1);
++              lp = (uint32_t *) (icp + 1);
+               Printf("\n%d bytes from %s to %s", cc,
+-                     inet_ntop(AF_INET6, &hip->saddr, pa1, sizeof(pa1)),
+-                     inet_ntop(AF_INET6, &hip->daddr, pa2, sizeof(pa2)));
++                     inet_ntop(AF_INET6, &hip->ip6_src, pa1, sizeof(pa1)),
++                     inet_ntop(AF_INET6, &hip->ip6_dst, pa2, sizeof(pa2)));
+               
+               Printf(": icmp type %d (%s) code %d\n", type, pr_type(type),
+                      icp->icmp6_code);
+-              for (i = sizeof(struct ipv6hdr); i < cc ; i += 4)
++              for (i = sizeof(struct ip6_hdr); i < cc ; i += 4)
+                       Printf("%2d: x%8.8x\n", i, *lp++);
+       }
diff --git a/packages/iputils/files/tracepath6-mtu-opt.patch b/packages/iputils/files/tracepath6-mtu-opt.patch
new file mode 100644 (file)
index 0000000..63c8e76
--- /dev/null
@@ -0,0 +1,35 @@
+This patch adds a manual option to set the MTU. The method to determine the
+local MTU is failing on sh4/2.6.14. It's not yet clear if this is an sh4,
+2.6.14 and glibc bug. The manual mtu option allows tracepath6 to still be
+used on this platform.
+
+--- new/tracepath6.c   2005/11/14 13:03:19     1.1
++++ new/tracepath6.c   2005/11/14 13:04:24
+@@ -267,7 +267,7 @@
+ static void usage(void)
+ {
+-      fprintf(stderr, "Usage: tracepath6 [-n] [-b] <destination>[/<port>]\n");
++      fprintf(stderr, "Usage: tracepath6 [-n] [-b] [-m <mtu>] <destination>[/<port>]\n");
+       exit(-1);
+ }
+@@ -282,7 +282,7 @@
+       struct hostent *he;
+       int ch;
+-      while ((ch = getopt(argc, argv, "nbh?")) != EOF) {
++      while ((ch = getopt(argc, argv, "nbh?m:")) != EOF) {
+               switch(ch) {
+               case 'n':       
+                       no_resolve = 1;
+@@ -290,6 +290,9 @@
+               case 'b':       
+                       show_both = 1;
+                       break;
++              case 'm':
++                      mtu = atol(optarg);
++                      break;
+               default:
+                       usage();
+               }
index 8ec7f54..ac3c3d3 100644 (file)
@@ -1,30 +1,62 @@
-SECTION = "console/utils"
-BROKEN = "1"
-DEPENDS = "docbook-utils-native"
-DESCRIPTION = "Utilities for the IP protocol."
+SECTION = "console/network"
+DESCRIPTION = "Utilities for the IP protocol, including traceroute6, \
+tracepath, tracepath6, ping, ping6 and arping."
 LICENSE ="BSD"
-SRC_URI = "http://www.tux.org/pub/people/alexey-kuznetsov/ip-routing/iputils-ss020927.tar.gz"
+PRIORITY = "optional"
+PR = "r2"
+
+SRC_URI = "http://www.tux.org/pub/people/alexey-kuznetsov/ip-routing/iputils-ss020927.tar.gz \
+           file://debian-fixes.patch;patch=1 \
+           file://makefile.patch;patch=1 \
+           file://standard-header-types.patch;patch=1 \
+           file://tracepath6-mtu-opt.patch;patch=1 \
+           file://remove-glibc-headers.patch;patch=1 \
+           file://iputils-retvals.patch;patch=1"
 S = "${WORKDIR}/iputils"
 
-EXTRA_OEMAKE = ""
+PACKAGES = "${PN}-ping ${PN}-ping6 ${PN}-arping ${PN}-tracepath ${PN}-tracepath6 ${PN}-traceroute6 ${PN}-doc"
+FILES_${PN}            = ""
+FILES_${PN}-ping       = "${base_bindir}/ping.${PN}"
+FILES_${PN}-ping6      = "${base_bindir}/ping6.${PN}"
+FILES_${PN}-arping     = "${bindir}/arping"
+FILES_${PN}-tracepath  = "${bindir}/tracepath"
+FILES_${PN}-tracepath6 = "${bindir}/tracepath6"
+FILES_${PN}-traceroute6        = "${bindir}/traceroute6"
+FILES_${PN}-doc                = "${mandir}/man8"
 
 do_compile () {
        oe_runmake 'CC=${CC}' \
                   KERNEL_INCLUDE="${STAGING_INCDIR}" \
                   LIBC_INCLUDE="${STAGING_INCDIR}"
-       oe_runmake -C doc 'CC=${CC}' \
-                  KERNEL_INCLUDE="${STAGING_INCDIR}" \
-                  LIBC_INCLUDE="${STAGING_INCDIR}"
 }
 
 do_install () {
-       install -d ${D}${base_bindir} ${D}${sbindir} \
-                  ${D}${mandir}/man8 ${D}${docdir}/${P}
-       install -m 0755 ping ${D}${base_bindir}/
-       for f in ipg tracepath clockdiff rdisc arping \
-               tftpd rarpd tracepath6 traceroute6 ping6; do
-               install -m 0755 $f ${D}${sbindir}/
+       install -m 0755 -d ${D}${base_bindir} ${D}${bindir} ${D}${mandir}/man8
+       # SUID root programs
+       install -m 4755 ping ${D}${base_bindir}/ping.${PN}
+       install -m 4755 ping6 ${D}${base_bindir}/ping6.${PN}
+       install -m 4755 traceroute6 ${D}${bindir}/
+       # Other programgs
+       for i in arping tracepath tracepath6; do
+         install -m 0755 $i ${D}${bindir}/
        done
-       install -m 0644 doc/*.8 ${D}${mandir}/man8/
-       install -m 0644 doc/*.html ${D}${docdir}/${P}/
+       # Manual pages for things we build packages for
+       for i in tracepath.8 traceroute6.8 ping.8 arping.8; do
+         install -m 0644 doc/$i ${D}${mandir}/man8/
+       done
+}
+
+# Busybox also provides ping and ping6, so use update-alternatives
+pkg_postinst_${PN}-ping () {
+       update-alternatives --install ${base_bindir}/ping ping ping.${PN} 100
+}
+pkg_prerm_${PN}-ping () {
+       update-alternatives --remove ping ping.${PN}
+}
+
+pkg_postinst_${PN}-ping6 () {
+       update-alternatives --install ${base_bindir}/ping6 ping6 ping6.${PN} 100
+}
+pkg_prerm_${PN}-ping6 () {
+       update-alternatives --remove ping6 ping6.${PN}
 }