]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix building on systems with musl (#10)
authorPeter Bui <pbui@github.bx612.space>
Sun, 20 Oct 2019 21:15:08 +0000 (17:15 -0400)
committerRoy Marples <roy@marples.name>
Sun, 20 Oct 2019 21:15:08 +0000 (22:15 +0100)
musl has its own definition of struct ethhdr, so only include
netinet/if_ether.h on systems with GLIBC.  For the ARPHDR constants, we
must include linux/if_arp.h instead.

src/if-linux.c

index fd4727852d96b16d1fc9a3b80eec06cbd6334680..3ee6c5c9d642f9e186f2751c67e69be5246c9f3d 100644 (file)
 
 #include <arpa/inet.h>
 #include <net/if.h>
-#include <netinet/if_ether.h>
 #include <netinet/in_systm.h>
 #include <netinet/in.h>
 #include <net/route.h>
 
+/* musl has its own definition of struct ethhdr, so only include
+ * netinet/if_ether.h on systems with GLIBC.  For the ARPHRD constants,
+ * we must include linux/if_arp.h instead. */
+#if defined(__GLIBC__)
+#include <netinet/if_ether.h>
+#else
+#include <linux/if_arp.h>
+#endif
+
 #include <errno.h>
 #include <fcntl.h>
 #include <ctype.h>