Matthew Burgess wrote:

Regardless, I think there may well be some merit in getting iputils to compile on an LFS setup, given Bruce's argument of a better/more complete feature set. I may be in a position to do that later today, but of course, everyone else is more than welcome to give it a go themselves!

OK, please find attached the trivial(ish) patch to allow iputils-ping to compile without errors or warnings on a GCC-4.0.1/Glibc-2.3.5 based LFS. Simply unpack the iputils tarball, apply the patch, then do 'make ping'.

Regards,

Matt.
diff -Naur iputils.orig/Makefile iputils/Makefile
--- iputils.orig/Makefile	2002-09-20 18:23:55.000000000 +0000
+++ iputils/Makefile	2005-08-21 13:52:00.000000000 +0000
@@ -1,5 +1,5 @@
 # Path to parent kernel include files directory
-KERNEL_INCLUDE=/usr/src/linux/include
+KERNEL_INCLUDE=/usr/include
 LIBC_INCLUDE=/usr/include
 
 DEFINES= 
@@ -8,14 +8,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
 
 
 #options if you compile with libc5, and without a bind>=4.9.4 libresolv
diff -Naur iputils.orig/ping.c iputils/ping.c
--- iputils.orig/ping.c	2002-09-20 15:08:11.000000000 +0000
+++ iputils/ping.c	2005-08-21 13:52:30.000000000 +0000
@@ -62,13 +62,19 @@
 
 #include <netinet/ip.h>
 #include <netinet/ip_icmp.h>
+#include <asm/byteorder.h>
 
 
 #define	MAXIPLEN	60
 #define	MAXICMPLEN	76
 #define	NROUTES		9		/* number of record route slots */
 #define TOS_MAX		255		/* 8-bit TOS field */
+#define ICMP_FILTER     1               /* Should really be in netinet/ip_icmp.h */
 
+/* Should really be in netinet/ip_icmp.h */
+struct icmp_filter {
+	__u32	data;
+};
 
 static int ts_type;
 static int nroute = 0;
@@ -249,7 +255,7 @@
 	}
 
 	if (source.sin_addr.s_addr == 0) {
-		int alen;
+		socklen_t alen;
 		struct sockaddr_in dst = whereto;
 		int probe_fd = socket(AF_INET, SOCK_DGRAM, 0);
 
diff -Naur iputils.orig/ping_common.c iputils/ping_common.c
--- iputils.orig/ping_common.c	2002-09-20 16:02:32.000000000 +0000
+++ iputils/ping_common.c	2005-08-21 13:52:00.000000000 +0000
@@ -67,7 +67,7 @@
 	int ii, jj, kk;
 	int pat[16];
 	char *cp;
-	char *bp = outpack+8;
+	unsigned char *bp = outpack+8;
 
 	for (cp = patp; *cp; cp++) {
 		if (!isxdigit(*cp)) {
@@ -393,7 +393,7 @@
 void sock_setbufs(int icmp_sock, int alloc)
 {
 	int rcvbuf, hold;
-	int tmplen = sizeof(hold);
+	socklen_t tmplen = sizeof(hold);
 
 	if (!sndbuf)
 		sndbuf = alloc;
@@ -464,7 +464,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!
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to