*: simplify Ethernet header includes

Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Dan Fandrich 2011-06-10 05:17:59 +02:00 committed by Denys Vlasenko
parent d488f5e8db
commit f533ec8767
10 changed files with 33 additions and 59 deletions

View File

@ -332,8 +332,8 @@ typedef unsigned smalluint;
/* ---- Who misses what? ------------------------------------ */ /* ---- Who misses what? ------------------------------------ */
/* Assume all these functions exist by default. Platforms where it is not /* Assume all these functions and header files exist by default.
* true will #undef them below. * Platforms where it is not true will #undef them below.
*/ */
#define HAVE_CLEARENV 1 #define HAVE_CLEARENV 1
#define HAVE_FDATASYNC 1 #define HAVE_FDATASYNC 1
@ -349,9 +349,14 @@ typedef unsigned smalluint;
#define HAVE_STRSEP 1 #define HAVE_STRSEP 1
#define HAVE_STRSIGNAL 1 #define HAVE_STRSIGNAL 1
#define HAVE_VASPRINTF 1 #define HAVE_VASPRINTF 1
#define HAVE_MNTENT_H 1
#define HAVE_SYS_STATFS_H 1
#define HAVE_XTABS 1 #define HAVE_XTABS 1
#define HAVE_MNTENT_H 1
#define HAVE_NET_ETHERNET_H 1
#define HAVE_SYS_STATFS_H 1
#if defined(__GLIBC__) && (__GLIBC__ < 2 || __GLIBC_MINOR__ < 1)
# undef HAVE_NET_ETHERNET_H
#endif
#if defined(__dietlibc__) #if defined(__dietlibc__)
# undef HAVE_STRCHRNUL # undef HAVE_STRCHRNUL
@ -368,6 +373,7 @@ typedef unsigned smalluint;
# undef HAVE_STRSEP # undef HAVE_STRSEP
# undef HAVE_STRSIGNAL # undef HAVE_STRSIGNAL
# undef HAVE_VASPRINTF # undef HAVE_VASPRINTF
# undef HAVE_NET_ETHERNET_H
#endif #endif
#if defined(__FreeBSD__) #if defined(__FreeBSD__)
@ -395,6 +401,7 @@ typedef unsigned smalluint;
# undef HAVE_DPRINTF # undef HAVE_DPRINTF
# undef HAVE_STPCPY # undef HAVE_STPCPY
# undef HAVE_STRCHRNUL # undef HAVE_STRCHRNUL
# undef HAVE_NET_ETHERNET_H
#endif #endif
/* /*

View File

@ -74,13 +74,11 @@
//usage: "\n -i iface Interface to use (default eth0)" //usage: "\n -i iface Interface to use (default eth0)"
//usage: "\n -p pass Append four or six byte password PW to the packet" //usage: "\n -p pass Append four or six byte password PW to the packet"
#include "libbb.h"
#include <netpacket/packet.h> #include <netpacket/packet.h>
#include <net/ethernet.h>
#include <netinet/ether.h> #include <netinet/ether.h>
#include <linux/if.h> #include <linux/if.h>
#include "libbb.h"
/* Note: PF_INET, SOCK_DGRAM, IPPROTO_UDP would allow SIOCGIFHWADDR to /* Note: PF_INET, SOCK_DGRAM, IPPROTO_UDP would allow SIOCGIFHWADDR to
* work as non-root, but we need SOCK_PACKET to specify the Ethernet * work as non-root, but we need SOCK_PACKET to specify the Ethernet
* destination address. * destination address.

View File

@ -46,18 +46,14 @@
//usage: " [mem_start NN] [io_addr NN] [irq NN]\n") //usage: " [mem_start NN] [io_addr NN] [irq NN]\n")
//usage: " [up|down] ..." //usage: " [up|down] ..."
#include "libbb.h"
#include "inet_common.h"
#include <net/if.h> #include <net/if.h>
#include <net/if_arp.h> #include <net/if_arp.h>
#include <netinet/in.h> #include <netinet/in.h>
#if defined(__GLIBC__) && __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1 #ifdef HAVE_NET_ETHERNET_H
#include <netpacket/packet.h>
# include <net/ethernet.h> # include <net/ethernet.h>
#else
#include <sys/types.h>
#include <netinet/if_ether.h>
#endif #endif
#include "libbb.h"
#include "inet_common.h"
#if ENABLE_FEATURE_IFCONFIG_SLIP #if ENABLE_FEATURE_IFCONFIG_SLIP
# include <net/if_slip.h> # include <net/if_slip.h>

View File

@ -37,7 +37,9 @@
#include <linux/if.h> #include <linux/if.h>
#include <linux/mii.h> #include <linux/mii.h>
#include <linux/ethtool.h> #include <linux/ethtool.h>
#ifdef HAVE_NET_ETHERNET_H
# include <net/ethernet.h> # include <net/ethernet.h>
#endif
#include <linux/netlink.h> #include <linux/netlink.h>
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#include <linux/sockios.h> #include <linux/sockios.h>

View File

@ -30,15 +30,14 @@
* 20001008 - Bernd Eckenfels, Patch from RH for setting mtu * 20001008 - Bernd Eckenfels, Patch from RH for setting mtu
* (default AF was wrong) * (default AF was wrong)
*/ */
#include <net/if.h>
#include <net/if_arp.h>
#ifndef __UCLIBC__
# include <net/ethernet.h>
#else
# include <linux/if_ether.h>
#endif
#include "libbb.h" #include "libbb.h"
#include "inet_common.h" #include "inet_common.h"
#include <net/if.h>
#include <net/if_arp.h>
#ifdef HAVE_NET_ETHERNET_H
# include <net/ethernet.h>
#endif
#if ENABLE_FEATURE_HWIB #if ENABLE_FEATURE_HWIB
/* #include <linux/if_infiniband.h> */ /* #include <linux/if_infiniband.h> */

View File

@ -12,11 +12,7 @@
#include "rt_names.h" #include "rt_names.h"
#include "utils.h" #include "utils.h"
#if defined(__GLIBC__) && __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1 #include <netinet/if_ether.h>
#include <net/ethernet.h>
#else
#include <linux/if_ether.h>
#endif
#if !ENABLE_WERROR #if !ENABLE_WERROR
#warning de-bloat #warning de-bloat

View File

@ -25,14 +25,8 @@
#include "dhcpd.h" #include "dhcpd.h"
#include "dhcpc.h" #include "dhcpc.h"
#include <asm/types.h> #include <netinet/if_ether.h>
#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION)
#include <netpacket/packet.h> #include <netpacket/packet.h>
# include <net/ethernet.h>
#else
# include <linux/if_packet.h>
# include <linux/if_ether.h>
#endif
#include <linux/filter.h> #include <linux/filter.h>
/* struct client_config_t client_config is in bb_common_bufsiz1 */ /* struct client_config_t client_config is in bb_common_bufsiz1 */

View File

@ -6,18 +6,11 @@
* *
* Licensed under GPLv2, see file LICENSE in this source tree. * 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 "common.h"
#include "dhcpd.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) void FAST_FUNC udhcp_init_header(struct dhcp_packet *packet, char type)
{ {

View File

@ -22,17 +22,8 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 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 "common.h"
#include <net/if.h>
int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *mac) int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *mac)
{ {

View File

@ -35,14 +35,12 @@
//usage: "\nWith no -q, runs continuously monitoring for ARP conflicts," //usage: "\nWith no -q, runs continuously monitoring for ARP conflicts,"
//usage: "\nexits only on I/O errors (link down etc)" //usage: "\nexits only on I/O errors (link down etc)"
#include "libbb.h"
#include <netinet/ether.h> #include <netinet/ether.h>
#include <net/ethernet.h>
#include <net/if.h> #include <net/if.h>
#include <net/if_arp.h> #include <net/if_arp.h>
#include <linux/if_packet.h>
#include <linux/sockios.h> #include <linux/sockios.h>
#include "libbb.h"
#include <syslog.h> #include <syslog.h>
/* We don't need more than 32 bits of the counter */ /* We don't need more than 32 bits of the counter */