Musl provides its own ethhdr struct definition. Add a guard to prevent its definition of the appropriate musl header has already been included. glibc does not implement this header, but when glibc will implement this they can just define __UAPI_DEF_ETHHDR 0 to make it work with the kernel.
Showing the changes to include/uapi (2 of 2 files). Show all
Unified · Split
| @@ -23,6 +23,7 @@ · 22 unmodified lines | ||
| 23 | 23 | #define _UAPI_LINUX_IF_ETHER_H |
| 24 | 24 | |
| 25 | 25 | #include <linux/types.h> |
| 26 | +#include <linux/libc-compat.h> | |
| 26 | 27 | |
| 27 | 28 | /* |
| 28 | 29 | * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble |
| @@ -149,11 +150,13 @@ · 120 unmodified lines | ||
| 149 | 150 | * This is an Ethernet frame header. |
| 150 | 151 | */ |
| 151 | 152 | |
| 153 | +#if __UAPI_DEF_ETHHDR | |
| 152 | 154 | struct ethhdr { |
| 153 | 155 | unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ |
| 154 | 156 | unsigned char h_source[ETH_ALEN]; /* source ether addr */ |
| 155 | 157 | __be16 h_proto; /* packet type ID field */ |
| 156 | 158 | } __attribute__((packed)); |
| 159 | +#endif | |
| 157 | 160 | |
| 158 | 161 | |
| 159 | 162 | #endif /* _UAPI_LINUX_IF_ETHER_H */ |
| @@ -264,4 +264,10 @@ · 263 unmodified lines | ||
| 264 | 264 | |
| 265 | 265 | #endif /* __GLIBC__ */ |
| 266 | 266 | |
| 267 | +/* Definitions for if_ether.h */ | |
| 268 | +/* allow libcs like musl to deactivate this, glibc does not implement this. */ | |
| 269 | +#ifndef __UAPI_DEF_ETHHDR | |
| 270 | +#define __UAPI_DEF_ETHHDR 1 | |
| 271 | +#endif | |
| 272 | + | |
| 267 | 273 | #endif /* _UAPI_LIBC_COMPAT_H */ |