*: simplify Ethernet header includes
authorDan Fandrich <dan@coneharvesters.com>
Fri, 10 Jun 2011 03:17:59 +0000 (05:17 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Fri, 10 Jun 2011 03:17:59 +0000 (05:17 +0200)
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
include/platform.h
networking/ether-wake.c
networking/ifconfig.c
networking/ifplugd.c
networking/interface.c
networking/libiproute/ll_proto.c
networking/udhcp/dhcpc.c
networking/udhcp/packet.c
networking/udhcp/socket.c
networking/zcip.c

index 780568c2b77f856c480eb22e8f23c6d651d45eaf..429220b0d65b406334ea8665ca27bfc226ebf230 100644 (file)
@@ -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__)
@@ -395,6 +401,7 @@ typedef unsigned smalluint;
 # undef HAVE_DPRINTF
 # undef HAVE_STPCPY
 # undef HAVE_STRCHRNUL
+# undef HAVE_NET_ETHERNET_H
 #endif
 
 /*
index 260ba24639013b4dab21620bbb26baef0d22242b..6a88279f4ee42d9705928604215e1c5a5c676f3d 100644 (file)
 //usage:     "\n       -i iface        Interface to use (default eth0)"
 //usage:     "\n       -p pass         Append four or six byte password PW to the packet"
 
+#include "libbb.h"
 #include <netpacket/packet.h>
-#include <net/ethernet.h>
 #include <netinet/ether.h>
 #include <linux/if.h>
 
-#include "libbb.h"
-
 /* Note: PF_INET, SOCK_DGRAM, IPPROTO_UDP would allow SIOCGIFHWADDR to
  * work as non-root, but we need SOCK_PACKET to specify the Ethernet
  * destination address.
index 2a56da56117cb58c3aed42bd373eb5b8908ebb95..b6604f5d15a0e4ff2bf1677f57208b187466afb7 100644 (file)
 //usage:       "       [mem_start NN] [io_addr NN] [irq NN]\n")
 //usage:       "       [up|down] ..."
 
+#include "libbb.h"
+#include "inet_common.h"
 #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>
-#else
-#include <sys/types.h>
-#include <netinet/if_ether.h>
+#ifdef HAVE_NET_ETHERNET_H
+# include <net/ethernet.h>
 #endif
-#include "libbb.h"
-#include "inet_common.h"
 
 #if ENABLE_FEATURE_IFCONFIG_SLIP
 # include <net/if_slip.h>
index 57d04e67b67bcd7e2b0abfbb09689ce99e4972ed..d8358cdfd5f92d25ae70a0d2b34236c897dd40c4 100644 (file)
@@ -37,7 +37,9 @@
 #include <linux/if.h>
 #include <linux/mii.h>
 #include <linux/ethtool.h>
-#include <net/ethernet.h>
+#ifdef HAVE_NET_ETHERNET_H
+# include <net/ethernet.h>
+#endif
 #include <linux/netlink.h>
 #include <linux/rtnetlink.h>
 #include <linux/sockios.h>
index bea54c180564f6e50a2267ce07119d6b6b2f2140..79c322ec01b3588c5ad5c0045d4a5727e7325a2d 100644 (file)
  *         20001008 - Bernd Eckenfels, Patch from RH for setting mtu
  *                     (default AF was wrong)
  */
+
+#include "libbb.h"
+#include "inet_common.h"
 #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>
 #endif
-#include "libbb.h"
-#include "inet_common.h"
 
 #if ENABLE_FEATURE_HWIB
 /* #include <linux/if_infiniband.h> */
index 04925ecf686635fa540db8a2719f1d8b4e29f443..7aac8364d362a574bf33066b3ee1b2229967852e 100644 (file)
 #include "rt_names.h"
 #include "utils.h"
 
-#if defined(__GLIBC__) && __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1
-#include <net/ethernet.h>
-#else
-#include <linux/if_ether.h>
-#endif
+#include <netinet/if_ether.h>
 
 #if !ENABLE_WERROR
 #warning de-bloat
index 5d3291b8cd46328cbc1c85b737ffd0edd4f4bc2b..4d755e6b8a063dfacd22fa3e79e158133e505dc5 100644 (file)
 #include "dhcpd.h"
 #include "dhcpc.h"
 
-#include <asm/types.h>
-#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION)
-# include <netpacket/packet.h>
-# include <net/ethernet.h>
-#else
-# include <linux/if_packet.h>
-# include <linux/if_ether.h>
-#endif
+#include <netinet/if_ether.h>
+#include <netpacket/packet.h>
 #include <linux/filter.h>
 
 /* struct client_config_t client_config is in bb_common_bufsiz1 */
index 2b7528cc702a5548d22c87e4d86cdee9ba50691f..66b42c5e1190752c39b55954c752ec9ee1dde23f 100644 (file)
@@ -6,18 +6,11 @@
  *
  * 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
-# include <netpacket/packet.h>
-# include <net/ethernet.h>
-#else
-# include <asm/types.h>
-# include <linux/if_packet.h>
-# include <linux/if_ether.h>
-#endif
-
 #include "common.h"
 #include "dhcpd.h"
+#include <netinet/in.h>
+#include <netinet/if_ether.h>
+#include <netpacket/packet.h>
 
 void FAST_FUNC udhcp_init_header(struct dhcp_packet *packet, char type)
 {
index 39f1cec5452e5caa5641a7e8d718b223e02730ea..a5220ba74263732d69add1d986658fa0ca1e66ee 100644 (file)
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-#include <net/if.h>
-#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION
-# include <netpacket/packet.h>
-# include <net/ethernet.h>
-#else
-# include <asm/types.h>
-# include <linux/if_packet.h>
-# include <linux/if_ether.h>
-#endif
-
 #include "common.h"
+#include <net/if.h>
 
 int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *mac)
 {
index 6b7f2144f75f89595b3a1cfabca093fa020f0033..8a35eca5d7202aab14493c60bbf1e6efb49d4972 100644 (file)
 //usage:     "\nWith no -q, runs continuously monitoring for ARP conflicts,"
 //usage:     "\nexits only on I/O errors (link down etc)"
 
+#include "libbb.h"
 #include <netinet/ether.h>
-#include <net/ethernet.h>
 #include <net/if.h>
 #include <net/if_arp.h>
-#include <linux/if_packet.h>
 #include <linux/sockios.h>
 
-#include "libbb.h"
 #include <syslog.h>
 
 /* We don't need more than 32 bits of the counter */