iputils' glibc-bugs workarounds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I recently had trouble building ping and ping6 from iputils because
of symbols defined both by glibc and by the kernel headers, so I put
together a patch to make the kernel headers only define them
when compiling kernel stuff, and to make iputils include a couple more
kernel headers.

Turns out I had inadvertantly disabled iputils' glibc-bugs workarounds
(cross-compiling iz hard), so my patch probably isn't needed (it's probably
incomplete anyway).
But since I went to the trouble of putting it together, may
as well post it, if only to bring up the following questions:

Presumably we want someday to get rid of the
need for workarounds like those used by iputils' Makefile, right?
If so, should glibc be fixed to provide the missing stuff, or should the kernel headers
be changed to make it easier to include them from userspace programs?
- Dan

Part 1: patch to iputils to grab linux-specific types:

--- iputils/ping_common.h.old   Fri Aug 29 16:54:12 2003
+++ iputils/ping_common.h       Fri Aug 29 20:01:04 2003
@@ -4,6 +4,7 @@
 #include <time.h>
 #include <sys/param.h>
 #include <sys/socket.h>
+#include <linux/types.h>
 #include <linux/sockios.h>
 #include <sys/file.h>
 #include <sys/time.h>
--- iputils/ping.c.old  Thu Oct 16 17:02:58 2003
+++ iputils/ping.c      Thu Oct 16 17:22:31 2003
@@ -63,6 +63,9 @@
 #include <netinet/ip.h>
 #include <netinet/ip_icmp.h>

+#include <asm/byteorder.h>
+#include <linux/icmp.h>
+
 #define        MAXIPLEN        60
 #define        MAXICMPLEN      76
 #define        NROUTES         9               /* number of record route slots */

Part 2: patch to linux kernel headers to not declare the conflicting types if not compiling kernel mode stuff:

--- linux-2.4.21/include/linux/ipv6.h.old	Thu Nov 22 11:47:11 2001
+++ linux-2.4.21/include/linux/ipv6.h	Thu Oct 16 16:26:15 2003
@@ -14,12 +14,12 @@
  *	*under construction*
  */

-
+#ifdef __KERNEL__	/* already defined by netinet/in.h for userspace */
 struct in6_pktinfo {
 	struct in6_addr	ipi6_addr;
 	int		ipi6_ifindex;
 };
-
+#endif

 struct in6_ifreq {
 	struct in6_addr	ifr6_addr;
--- linux-2.4.21/include/linux/in6.h.old	Fri Jun 13 07:51:38 2003
+++ linux-2.4.21/include/linux/in6.h	Thu Oct 16 16:27:24 2003
@@ -26,7 +26,7 @@
 /*
  *	IPv6 address structure
  */
-
+#ifdef __KERNEL__	/* already defined by netinet/in.h for userspace */
 struct in6_addr
 {
 	union
@@ -64,6 +64,7 @@
 	/* local IPv6 address of interface */
 	int		ipv6mr_ifindex;
 };
+#endif

#define ipv6mr_acaddr ipv6mr_multiaddr

--- linux-2.4.21/include/linux/icmp.h.old	Thu Oct 16 17:17:33 2003
+++ linux-2.4.21/include/linux/icmp.h	Thu Oct 16 17:18:29 2003
@@ -62,7 +62,7 @@
 #define ICMP_EXC_TTL		0	/* TTL count exceeded		*/
 #define ICMP_EXC_FRAGTIME	1	/* Fragment Reass time exceeded	*/

-
+#ifdef __KERNEL__	/* already defined for userspace by <netinet/ip_icmp.h> */
 struct icmphdr {
   __u8		type;
   __u8		code;
@@ -79,6 +79,7 @@
 	} frag;
   } un;
 };
+#endif

 /*
  *	constants for (set|get)sockopt


-- Dan Kegel http://www.kegel.com http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux