[PATCH 4/5] Gate including net/ethernet.h on HAVE_NET_ETHERNET_H
Dan Fandrich
dan at coneharvesters.com
Wed Jun 1 20:36:20 UTC 2011
Signed-off-by: Dan Fandrich <dan at coneharvesters.com>
---
include/platform.h | 12 +++++++++---
networking/ether-wake.c | 2 ++
networking/ifconfig.c | 10 +++++-----
networking/ifplugd.c | 2 ++
networking/interface.c | 2 +-
networking/libiproute/iplink.c | 9 +++++++--
networking/libiproute/ll_proto.c | 6 +++---
networking/udhcp/dhcpc.c | 2 +-
networking/udhcp/packet.c | 2 +-
networking/udhcp/socket.c | 2 +-
networking/zcip.c | 2 ++
11 files changed, 34 insertions(+), 17 deletions(-)
diff --git a/include/platform.h b/include/platform.h
index 2b84447..0b83d8f 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -332,8 +332,8 @@ typedef unsigned smalluint;
/* ---- Who misses what? ------------------------------------ */
-/* Assume all these functions exist by default. Platforms where it is not
- * true will #undef them below.
+/* Assume all these functions and header files exist by default.
+ * Platforms where it is not true will #undef them below.
*/
#define HAVE_CLEARENV 1
#define HAVE_FDATASYNC 1
@@ -349,9 +349,14 @@ typedef unsigned smalluint;
#define HAVE_STRSEP 1
#define HAVE_STRSIGNAL 1
#define HAVE_VASPRINTF 1
+#define HAVE_XTABS 1
#define HAVE_MNTENT_H 1
+#define HAVE_NET_ETHERNET_H 1
#define HAVE_SYS_STATFS_H 1
-#define HAVE_XTABS 1
+
+#if defined(__GLIBC__) && (__GLIBC__ < 2 || __GLIBC_MINOR__ < 1)
+# undef HAVE_NET_ETHERNET_H
+#endif
#if defined(__dietlibc__)
# undef HAVE_STRCHRNUL
@@ -368,6 +373,7 @@ typedef unsigned smalluint;
# undef HAVE_STRSEP
# undef HAVE_STRSIGNAL
# undef HAVE_VASPRINTF
+# undef HAVE_NET_ETHERNET_H
#endif
#if defined(__FreeBSD__)
diff --git a/networking/ether-wake.c b/networking/ether-wake.c
index 7bb9aa5..f4d18f9 100644
--- a/networking/ether-wake.c
+++ b/networking/ether-wake.c
@@ -75,8 +75,10 @@
//usage: "\n -i iface Interface to use (default eth0)"
//usage: "\n -p pass Append four or six byte password PW to the packet"
+#ifdef HAVE_NET_ETHERNET_H
#include <netpacket/packet.h>
#include <net/ethernet.h>
+#endif
#include <netinet/ether.h>
#include <linux/if.h>
diff --git a/networking/ifconfig.c b/networking/ifconfig.c
index 220b021..4f9a4ca 100644
--- a/networking/ifconfig.c
+++ b/networking/ifconfig.c
@@ -50,12 +50,12 @@
#include <net/if.h>
#include <net/if_arp.h>
#include <netinet/in.h>
-#if defined(__GLIBC__) && __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1
-#include <netpacket/packet.h>
-#include <net/ethernet.h>
+#ifdef HAVE_NET_ETHERNET_H
+# include <netpacket/packet.h>
+# include <net/ethernet.h>
#else
-#include <sys/types.h>
-#include <netinet/if_ether.h>
+# include <sys/types.h>
+# include <netinet/if_ether.h>
#endif
#include "libbb.h"
#include "inet_common.h"
diff --git a/networking/ifplugd.c b/networking/ifplugd.c
index 421611a..798151c 100644
--- a/networking/ifplugd.c
+++ b/networking/ifplugd.c
@@ -38,7 +38,9 @@
#include <linux/if.h>
#include <linux/mii.h>
#include <linux/ethtool.h>
+#ifdef HAVE_NET_ETHERNET_H
#include <net/ethernet.h>
+#endif
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <linux/sockios.h>
diff --git a/networking/interface.c b/networking/interface.c
index bea54c1..7ff03bf 100644
--- a/networking/interface.c
+++ b/networking/interface.c
@@ -32,7 +32,7 @@
*/
#include <net/if.h>
#include <net/if_arp.h>
-#ifndef __UCLIBC__
+#ifdef HAVE_NET_ETHERNET_H
# include <net/ethernet.h>
#else
# include <linux/if_ether.h>
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c
index 82ab979..3305fe4 100644
--- a/networking/libiproute/iplink.c
+++ b/networking/libiproute/iplink.c
@@ -6,8 +6,13 @@
*/
#include <net/if.h>
#include <net/if_packet.h>
-#include <netpacket/packet.h>
-#include <net/ethernet.h>
+#ifdef HAVE_NET_ETHERNET_H
+# include <netpacket/packet.h>
+# include <net/ethernet.h>
+#else
+# include <sys/types.h>
+# include <netinet/if_ether.h>
+#endif
#include "ip_common.h" /* #include "libbb.h" is inside */
#include "rt_names.h"
diff --git a/networking/libiproute/ll_proto.c b/networking/libiproute/ll_proto.c
index 04925ec..04e58fb 100644
--- a/networking/libiproute/ll_proto.c
+++ b/networking/libiproute/ll_proto.c
@@ -12,10 +12,10 @@
#include "rt_names.h"
#include "utils.h"
-#if defined(__GLIBC__) && __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1
-#include <net/ethernet.h>
+#ifdef HAVE_NET_ETHERNET_H
+# include <net/ethernet.h>
#else
-#include <linux/if_ether.h>
+# include <linux/if_ether.h>
#endif
#if !ENABLE_WERROR
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 510c3a1..ae7c35d 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -26,7 +26,7 @@
#include "dhcpc.h"
#include <asm/types.h>
-#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION)
+#ifdef HAVE_NET_ETHERNET_H
# include <netpacket/packet.h>
# include <net/ethernet.h>
#else
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c
index 2b7528c..3bb62db 100644
--- a/networking/udhcp/packet.c
+++ b/networking/udhcp/packet.c
@@ -7,7 +7,7 @@
* Licensed under GPLv2, see file LICENSE in this source tree.
*/
#include <netinet/in.h>
-#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION
+#ifdef HAVE_NET_ETHERNET_H
# include <netpacket/packet.h>
# include <net/ethernet.h>
#else
diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c
index 39f1cec..7955de6 100644
--- a/networking/udhcp/socket.c
+++ b/networking/udhcp/socket.c
@@ -23,7 +23,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <net/if.h>
-#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION
+#ifdef HAVE_NET_ETHERNET_H
# include <netpacket/packet.h>
# include <net/ethernet.h>
#else
diff --git a/networking/zcip.c b/networking/zcip.c
index 7250fb2..72c8ca9 100644
--- a/networking/zcip.c
+++ b/networking/zcip.c
@@ -37,7 +37,9 @@
//usage: "\nexits only on I/O errors (link down etc)"
#include <netinet/ether.h>
+#ifdef HAVE_NET_ETHERNET_H
#include <net/ethernet.h>
+#endif
#include <net/if.h>
#include <net/if_arp.h>
#include <linux/if_packet.h>
--
1.5.3.2
More information about the busybox
mailing list