all: adjust imports to fix libc/linux headers

Linux headers and some libc headers have overlapping defines
for network types and functions.

In the past years, glibc and linux headers were improved to cooperate
so you could include either one, in any order.

With musl and possibly some older glibc versions that doesn't work so
well.

Reorder and change includes to make it work better. Yes, this looks
pretty random and unmotivated. The includes are changed in order to
successfully build on various libc/kernel versions, with the goal
of not using #if.
This commit is contained in:
Thomas Haller
2020-12-22 16:47:51 +01:00
parent 44e25bbb96
commit c50da167bc
3 changed files with 7 additions and 3 deletions

View File

@@ -8,7 +8,6 @@
#include "nm-device.h"
#include <netinet/in.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <signal.h>
@@ -16,8 +15,10 @@
#include <sys/wait.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <linux/if.h>
#include <linux/if_addr.h>
#include <linux/if_arp.h>
#include <linux/rtnetlink.h>
#include <linux/if_ether.h>
#include <linux/if_infiniband.h>

View File

@@ -6,6 +6,7 @@
#include "nm-default.h"
#include <fcntl.h>
#include <netinet/if_ether.h>
#include <linux/if_tun.h>
#include <sys/ioctl.h>
#include <sys/stat.h>

View File

@@ -12,9 +12,10 @@
#include <endian.h>
#include <fcntl.h>
#include <libudev.h>
#include <net/ethernet.h>
#include <linux/fib_rules.h>
#include <linux/ip.h>
#include <linux/if_arp.h>
#include <linux/if.h>
#include <linux/if_bridge.h>
#include <linux/if_link.h>
#include <linux/if_tun.h>
@@ -24,6 +25,7 @@
#include <linux/tc_act/tc_mirred.h>
#include <netinet/icmp6.h>
#include <netinet/in.h>
#include <net/if_arp.h>
#include <poll.h>
#include <sys/ioctl.h>
#include <sys/socket.h>