Skip to content

Commit

Permalink
libc-compat.h: prevent redefinition of struct ethhdr
Browse files Browse the repository at this point in the history
  • Loading branch information
rofl0r committed Jan 22, 2014
1 parent 3cd5b95 commit 4ffbb51
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion generic/include/linux/if_ether.h
Expand Up @@ -22,6 +22,7 @@
#define _LINUX_IF_ETHER_H

#include <linux/types.h>
#include <linux/libc-compat.h>

/*
* IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble
Expand Down Expand Up @@ -130,11 +131,12 @@
* This is an Ethernet frame header.
*/

#if __UAPI_DEF_ETHHDR
struct ethhdr {
unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
unsigned char h_source[ETH_ALEN]; /* source ether addr */
__be16 h_proto; /* packet type ID field */
} __attribute__((packed));

#endif

#endif /* _LINUX_IF_ETHER_H */
6 changes: 6 additions & 0 deletions generic/include/linux/libc-compat.h
Expand Up @@ -50,6 +50,12 @@

#ifndef __KERNEL__ /* we're used from userspace */

#ifdef _NETINET_IF_ETHER_H /* musl */
#define __UAPI_DEF_ETHHDR 0
#else /* glibc uses __NETINET_IF_ETHER_H, and includes the kernel header. */
#define __UAPI_DEF_ETHHDR 1
#endif

/* Coordinate with libc netinet/in.h header. */
#if defined(_NETINET_IN_H)

Expand Down

0 comments on commit 4ffbb51

Please sign in to comment.