gentoo-overlay/sys-apps/systemd/files/0005-Use-libc-over-Linux-UA...

761 lines
24 KiB
Diff
Raw Permalink Normal View History

From f423321481330c5f2f9158c490162b2e62b4c8bd Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Date: Sun, 18 Aug 2024 02:15:10 -0500
Subject: [PATCH 05/34] Use libc over Linux UAPI headers when possible
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
The Linux UAPI headers cause a lot of breakage. I can see that upstream
has started doing this already with some of the comments, so it is
possible this might need to be massaged and upstreamed.
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
---
src/basic/arphrd-util.c | 3 ++-
src/basic/generate-arphrd-list.sh | 2 +-
src/basic/socket-util.h | 2 +-
src/libsystemd-network/sd-dhcp6-client.c | 3 ++-
src/libsystemd/sd-netlink/netlink-message-rtnl.c | 1 +
src/libsystemd/sd-netlink/netlink-types-rtnl.c | 1 +
src/network/netdev/bareudp.c | 3 ++-
src/network/netdev/batadv.c | 2 +-
src/network/netdev/bond.c | 3 ++-
src/network/netdev/bridge.c | 5 +++--
src/network/netdev/dummy.c | 2 +-
src/network/netdev/geneve.c | 2 +-
src/network/netdev/ifb.c | 2 +-
src/network/netdev/ipoib.c | 2 +-
src/network/netdev/ipvlan.c | 2 +-
src/network/netdev/macsec.c | 3 ++-
src/network/netdev/macvlan.c | 2 +-
src/network/netdev/netdev-gperf.gperf | 1 +
src/network/netdev/netdev.c | 3 ++-
src/network/netdev/netdevsim.c | 2 +-
src/network/netdev/nlmon.c | 2 +-
src/network/netdev/tunnel.c | 3 ++-
src/network/netdev/tuntap.c | 2 +-
src/network/netdev/vcan.c | 2 +-
src/network/netdev/veth.c | 2 +-
src/network/netdev/vlan.c | 2 +-
src/network/netdev/vrf.c | 2 +-
src/network/netdev/vxcan.c | 2 +-
src/network/netdev/vxlan.c | 2 +-
src/network/netdev/wireguard.c | 5 +++--
src/network/netdev/xfrm.c | 2 +-
src/network/networkctl.c | 1 +
src/network/networkd-bridge-mdb.c | 2 ++
src/network/networkd-bridge-vlan.c | 1 +
src/network/networkd-dhcp-common.c | 4 +++-
src/network/networkd-dhcp-prefix-delegation.c | 1 +
src/network/networkd-dhcp-server.c | 3 ++-
src/network/networkd-dhcp4.c | 3 ++-
src/network/networkd-ipv6ll.c | 2 +-
src/network/networkd-link.c | 3 ++-
src/network/networkd-ndisc.c | 3 ++-
src/network/networkd-network.c | 1 +
src/network/networkd-route.c | 1 +
src/network/networkd-setlink.c | 3 ++-
src/network/networkd-sysctl.c | 2 +-
src/network/test-network-tables.c | 1 +
src/shared/ethtool-util.c | 1 +
src/shared/netif-util.c | 2 +-
src/test/test-arphrd-util.c | 2 +-
src/udev/net/link-config.c | 1 +
src/udev/udev-builtin-net_id.c | 3 ++-
51 files changed, 71 insertions(+), 41 deletions(-)
diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
index 3ea2c9d09a90..e21b60957376 100644
--- a/src/basic/arphrd-util.c
+++ b/src/basic/arphrd-util.c
@@ -1,8 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
+#include <net/if_arp.h>
+#include <netinet/if_ether.h>
#include <netinet/in.h>
-#include <linux/if_arp.h>
#include <linux/if_infiniband.h>
#include <string.h>
diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
index ca1ba7cad4d1..2e8fb64ba305 100755
--- a/src/basic/generate-arphrd-list.sh
+++ b/src/basic/generate-arphrd-list.sh
@@ -3,6 +3,6 @@
set -eu
set -o pipefail
-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
+${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
sed -e 's/ARPHRD_//'
diff --git a/src/basic/socket-util.h b/src/basic/socket-util.h
index c784125ccb42..4b759a42e648 100644
--- a/src/basic/socket-util.h
+++ b/src/basic/socket-util.h
@@ -3,7 +3,7 @@
#include <inttypes.h>
#include <linux/netlink.h>
-#include <linux/if_ether.h>
+#include <netinet/if_ether.h>
#include <linux/if_infiniband.h>
#include <linux/if_packet.h>
#include <netinet/in.h>
diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
index 3e992d7cadcd..131bc83c614c 100644
--- a/src/libsystemd-network/sd-dhcp6-client.c
+++ b/src/libsystemd-network/sd-dhcp6-client.c
@@ -4,8 +4,9 @@
***/
#include <errno.h>
+#include <net/if_arp.h>
+#include <netinet/if_ether.h>
#include <sys/ioctl.h>
-#include <linux/if_arp.h>
#include <linux/if_infiniband.h>
#include "sd-dhcp6-client.h"
diff --git a/src/libsystemd/sd-netlink/netlink-message-rtnl.c b/src/libsystemd/sd-netlink/netlink-message-rtnl.c
index fb11c7e02bb2..5159b122653c 100644
--- a/src/libsystemd/sd-netlink/netlink-message-rtnl.c
+++ b/src/libsystemd/sd-netlink/netlink-message-rtnl.c
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <netinet/if_ether.h>
#include <netinet/in.h>
#include <linux/fib_rules.h>
#include <linux/if_addrlabel.h>
diff --git a/src/libsystemd/sd-netlink/netlink-types-rtnl.c b/src/libsystemd/sd-netlink/netlink-types-rtnl.c
index e39a75cfe475..dbf2583dd815 100644
--- a/src/libsystemd/sd-netlink/netlink-types-rtnl.c
+++ b/src/libsystemd/sd-netlink/netlink-types-rtnl.c
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <netinet/if_ether.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <linux/batman_adv.h>
diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
index 1df886573ba2..d324c716917b 100644
--- a/src/network/netdev/bareudp.c
+++ b/src/network/netdev/bareudp.c
@@ -1,8 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later
* Copyright © 2020 VMware, Inc. */
+#include <net/if_arp.h>
+#include <netinet/if_ether.h>
#include <netinet/in.h>
-#include <linux/if_arp.h>
#include "bareudp.h"
#include "netlink-util.h"
diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
index 26da0231d459..dbdfc7f80ee2 100644
--- a/src/network/netdev/batadv.c
+++ b/src/network/netdev/batadv.c
@@ -1,9 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <inttypes.h>
+#include <net/if_arp.h>
#include <netinet/in.h>
#include <linux/genetlink.h>
-#include <linux/if_arp.h>
#include "batadv.h"
#include "fileio.h"
diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
index 52a7f126b6db..dc5d1fedb229 100644
--- a/src/network/netdev/bond.c
+++ b/src/network/netdev/bond.c
@@ -1,7 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <net/if_arp.h>
+#include <netinet/if_ether.h>
#include <netinet/in.h>
-#include <linux/if_arp.h>
#include "alloc-util.h"
#include "bond.h"
diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
index d426c0c5019f..0f60a7dfae9b 100644
--- a/src/network/netdev/bridge.c
+++ b/src/network/netdev/bridge.c
@@ -2,9 +2,10 @@
/* Make sure the net/if.h header is included before any linux/ one */
#include <net/if.h>
-#include <linux/if_arp.h>
-#include <linux/if_bridge.h>
+#include <net/if_arp.h>
+#include <netinet/if_ether.h>
#include <netinet/in.h>
+#include <linux/if_bridge.h>
#include "bridge.h"
#include "netlink-util.h"
diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
index 00df1d278737..9e03d02b42ea 100644
--- a/src/network/netdev/dummy.c
+++ b/src/network/netdev/dummy.c
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <linux/if_arp.h>
+#include <net/if_arp.h>
#include "dummy.h"
diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
index 22c2b00e1b70..170aeddfd597 100644
--- a/src/network/netdev/geneve.c
+++ b/src/network/netdev/geneve.c
@@ -2,7 +2,7 @@
/* Make sure the net/if.h header is included before any linux/ one */
#include <net/if.h>
-#include <linux/if_arp.h>
+#include <net/if_arp.h>
#include <netinet/in.h>
#include "alloc-util.h"
diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
index d7ff44cb9ea6..747733139ac7 100644
--- a/src/network/netdev/ifb.c
+++ b/src/network/netdev/ifb.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later
* Copyright © 2019 VMware, Inc. */
-#include <linux/if_arp.h>
+#include <net/if_arp.h>
#include "ifb.h"
diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
index d5fe299b7b43..a3d9309d7b5e 100644
--- a/src/network/netdev/ipoib.c
+++ b/src/network/netdev/ipoib.c
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <linux/if_arp.h>
+#include <net/if_arp.h>
#include <linux/if_link.h>
#include "ipoib.h"
diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
index 51ae64341db2..5908733b6b57 100644
--- a/src/network/netdev/ipvlan.c
+++ b/src/network/netdev/ipvlan.c
@@ -2,8 +2,8 @@
/* Make sure the net/if.h header is included before any linux/ one */
#include <net/if.h>
+#include <net/if_arp.h>
#include <netinet/in.h>
-#include <linux/if_arp.h>
#include "conf-parser.h"
#include "ipvlan.h"
diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
index 4b9f19cc95cf..58729ad29461 100644
--- a/src/network/netdev/macsec.c
+++ b/src/network/netdev/macsec.c
@@ -1,7 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <net/if_arp.h>
+#include <netinet/if_ether.h>
#include <netinet/in.h>
-#include <linux/if_arp.h>
#include <linux/if_ether.h>
#include <linux/if_macsec.h>
#include <linux/genetlink.h>
diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
index 21933d3970a1..adbe9817e7b3 100644
--- a/src/network/netdev/macvlan.c
+++ b/src/network/netdev/macvlan.c
@@ -2,8 +2,8 @@
/* Make sure the net/if.h header is included before any linux/ one */
#include <net/if.h>
+#include <net/if_arp.h>
#include <netinet/in.h>
-#include <linux/if_arp.h>
#include "conf-parser.h"
#include "macvlan.h"
diff --git a/src/network/netdev/netdev-gperf.gperf b/src/network/netdev/netdev-gperf.gperf
index 4883a2652d46..3d2b560941de 100644
--- a/src/network/netdev/netdev-gperf.gperf
+++ b/src/network/netdev/netdev-gperf.gperf
@@ -3,6 +3,7 @@
#if __GNUC__ >= 7
_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
#endif
+#include <netinet/if_ether.h>
#include <stddef.h>
#include "bareudp.h"
#include "batadv.h"
diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
index 2b411425ba16..db44e67df621 100644
--- a/src/network/netdev/netdev.c
+++ b/src/network/netdev/netdev.c
@@ -2,8 +2,9 @@
/* Make sure the net/if.h header is included before any linux/ one */
#include <net/if.h>
+#include <net/if_arp.h>
+#include <netinet/if_ether.h>
#include <netinet/in.h>
-#include <linux/if_arp.h>
#include <unistd.h>
#include "alloc-util.h"
diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
index 15d5c132f967..8b1d3440325b 100644
--- a/src/network/netdev/netdevsim.c
+++ b/src/network/netdev/netdevsim.c
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <linux/if_arp.h>
+#include <net/if_arp.h>
#include "netdevsim.h"
diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
index ff372092e614..3118df501054 100644
--- a/src/network/netdev/nlmon.c
+++ b/src/network/netdev/nlmon.c
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <linux/if_arp.h>
+#include <net/if_arp.h>
#include "nlmon.h"
diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
index db84e7cf6eeb..1789f532b762 100644
--- a/src/network/netdev/tunnel.c
+++ b/src/network/netdev/tunnel.c
@@ -1,8 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <net/if_arp.h>
+#include <netinet/if_ether.h>
#include <netinet/in.h>
#include <linux/fou.h>
-#include <linux/if_arp.h>
#include <linux/if_tunnel.h>
#include <linux/ip.h>
#include <linux/ip6_tunnel.h>
diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
index f5be31ed9438..06a0c3e616f0 100644
--- a/src/network/netdev/tuntap.c
+++ b/src/network/netdev/tuntap.c
@@ -2,10 +2,10 @@
/* Make sure the net/if.h header is included before any linux/ one */
#include <net/if.h>
+#include <netinet/if_ether.h>
#include <errno.h>
#include <fcntl.h>
#include <linux/if_tun.h>
-#include <netinet/if_ether.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
index 380547ee1e85..5dbf74f10c4d 100644
--- a/src/network/netdev/vcan.c
+++ b/src/network/netdev/vcan.c
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <linux/if_arp.h>
+#include <net/if_arp.h>
#include "vcan.h"
diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
index 78555286d1a4..4dc4ed146a8a 100644
--- a/src/network/netdev/veth.c
+++ b/src/network/netdev/veth.c
@@ -2,8 +2,8 @@
/* Make sure the net/if.h header is included before any linux/ one */
#include <net/if.h>
+#include <net/if_arp.h>
#include <errno.h>
-#include <linux/if_arp.h>
#include <linux/veth.h>
#include <netinet/in.h>
diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
index 60e49a5b8a9a..1dd2b962ac86 100644
--- a/src/network/netdev/vlan.c
+++ b/src/network/netdev/vlan.c
@@ -2,8 +2,8 @@
/* Make sure the net/if.h header is included before any linux/ one */
#include <net/if.h>
+#include <net/if_arp.h>
#include <errno.h>
-#include <linux/if_arp.h>
#include <linux/if_vlan.h>
#include "parse-util.h"
diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
index 24079a7203c8..9108c891cc13 100644
--- a/src/network/netdev/vrf.c
+++ b/src/network/netdev/vrf.c
@@ -2,7 +2,7 @@
/* Make sure the net/if.h header is included before any linux/ one */
#include <net/if.h>
-#include <linux/if_arp.h>
+#include <net/if_arp.h>
#include <netinet/in.h>
#include "vrf.h"
diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
index c0343f45b621..7d74950c33fa 100644
--- a/src/network/netdev/vxcan.c
+++ b/src/network/netdev/vxcan.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <net/if_arp.h>
#include <linux/can/vxcan.h>
-#include <linux/if_arp.h>
#include "vxcan.h"
diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
index 37f65967a6bd..065b3966bd79 100644
--- a/src/network/netdev/vxlan.c
+++ b/src/network/netdev/vxlan.c
@@ -2,8 +2,8 @@
/* Make sure the net/if.h header is included before any linux/ one */
#include <net/if.h>
+#include <net/if_arp.h>
#include <netinet/in.h>
-#include <linux/if_arp.h>
#include "conf-parser.h"
#include "alloc-util.h"
diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
index fed1be8d1104..ff4d1c1bc501 100644
--- a/src/network/netdev/wireguard.c
+++ b/src/network/netdev/wireguard.c
@@ -5,9 +5,10 @@
/* Make sure the net/if.h header is included before any linux/ one */
#include <net/if.h>
-#include <linux/if_arp.h>
-#include <linux/ipv6_route.h>
+#include <net/if_arp.h>
+#include <netinet/if_ether.h>
#include <netinet/in.h>
+#include <linux/ipv6_route.h>
#include <sys/ioctl.h>
#include "sd-resolve.h"
diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
index 905bfc0bdf03..c4a226da19a0 100644
--- a/src/network/netdev/xfrm.c
+++ b/src/network/netdev/xfrm.c
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <linux/if_arp.h>
+#include <net/if_arp.h>
#include "missing_network.h"
#include "xfrm.h"
diff --git a/src/network/networkctl.c b/src/network/networkctl.c
index a447c39a6414..0dbdbe0837f2 100644
--- a/src/network/networkctl.c
+++ b/src/network/networkctl.c
@@ -2,6 +2,7 @@
/* Make sure the net/if.h header is included before any linux/ one */
#include <net/if.h>
+#include <net/ethernet.h>
#include <arpa/inet.h>
#include <getopt.h>
#include <linux/if_addrlabel.h>
diff --git a/src/network/networkd-bridge-mdb.c b/src/network/networkd-bridge-mdb.c
index 7ff4a1884671..9b417e3bf58b 100644
--- a/src/network/networkd-bridge-mdb.c
+++ b/src/network/networkd-bridge-mdb.c
@@ -2,6 +2,8 @@
/* Make sure the net/if.h header is included before any linux/ one */
#include <net/if.h>
+#include <netinet/if_ether.h>
+#include <netinet/in.h>
#include <linux/if_bridge.h>
#include "netlink-util.h"
diff --git a/src/network/networkd-bridge-vlan.c b/src/network/networkd-bridge-vlan.c
index 0deffa46510d..94b15550205a 100644
--- a/src/network/networkd-bridge-vlan.c
+++ b/src/network/networkd-bridge-vlan.c
@@ -3,6 +3,7 @@
Copyright © 2016 BISDN GmbH. All rights reserved.
***/
+#include <netinet/if_ether.h>
#include <netinet/in.h>
#include <linux/if_bridge.h>
#include <stdbool.h>
diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
index 9f0268d934e4..a452dafb8a97 100644
--- a/src/network/networkd-dhcp-common.c
+++ b/src/network/networkd-dhcp-common.c
@@ -1,7 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <net/if.h>
+#include <net/if_arp.h>
+#include <netinet/if_ether.h>
#include <netinet/in.h>
-#include <linux/if_arp.h>
#include "bus-error.h"
#include "bus-locator.h"
diff --git a/src/network/networkd-dhcp-prefix-delegation.c b/src/network/networkd-dhcp-prefix-delegation.c
index 2e660b77631a..25b3fb747406 100644
--- a/src/network/networkd-dhcp-prefix-delegation.c
+++ b/src/network/networkd-dhcp-prefix-delegation.c
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <netinet/in.h>
#include <linux/ipv6_route.h>
#include "dhcp6-lease-internal.h"
diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
index c35102af74a5..8fb7700e8cd3 100644
--- a/src/network/networkd-dhcp-server.c
+++ b/src/network/networkd-dhcp-server.c
@@ -1,7 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <net/if_arp.h>
+#include <netinet/if_ether.h>
#include <netinet/in.h>
-#include <linux/if_arp.h>
#include <linux/if.h>
#include "sd-dhcp-server.h"
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
index 4dd6044b1897..359a8bd3b5e2 100644
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -1,9 +1,10 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <net/if_arp.h>
+#include <netinet/if_ether.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <linux/if.h>
-#include <linux/if_arp.h>
#include "alloc-util.h"
#include "dhcp-client-internal.h"
diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
index 32229a3fc70e..5e5d2926f3e2 100644
--- a/src/network/networkd-ipv6ll.c
+++ b/src/network/networkd-ipv6ll.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <net/if_arp.h>
#include <linux/if.h>
-#include <linux/if_arp.h>
#include "in-addr-util.h"
#include "networkd-address.h"
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 9ce75361fdca..17ab1b38be15 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -2,9 +2,10 @@
/* Make sure the net/if.h header is included before any linux/ one */
#include <net/if.h>
+#include <net/if_arp.h>
+#include <netinet/if_ether.h>
#include <netinet/in.h>
#include <linux/if.h>
-#include <linux/if_arp.h>
#include <linux/if_link.h>
#include <linux/netdevice.h>
#include <sys/socket.h>
diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
index 84558a5afc5c..23a0dc06172f 100644
--- a/src/network/networkd-ndisc.c
+++ b/src/network/networkd-ndisc.c
@@ -4,9 +4,10 @@
***/
#include <arpa/inet.h>
+#include <net/if_arp.h>
+#include <netinet/if_ether.h>
#include <netinet/icmp6.h>
#include <linux/if.h>
-#include <linux/if_arp.h>
#include "sd-ndisc.h"
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 8232db06c934..fd3599420831 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -2,6 +2,7 @@
/* Make sure the net/if.h header is included before any linux/ one */
#include <net/if.h>
+#include <netinet/if_ether.h>
#include <netinet/in.h>
#include <linux/netdevice.h>
#include <unistd.h>
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index d596fd81e63c..e2dcc87f6c2e 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <netinet/in.h>
#include <linux/ipv6_route.h>
#include <linux/nexthop.h>
diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
index 058bc00ba10b..3f84f9ca58a5 100644
--- a/src/network/networkd-setlink.c
+++ b/src/network/networkd-setlink.c
@@ -1,8 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <net/if_arp.h>
+#include <netinet/if_ether.h>
#include <netinet/in.h>
#include <linux/if.h>
-#include <linux/if_arp.h>
#include <linux/if_bridge.h>
#include "missing_network.h"
diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
index 68c23e0eb796..fb56ee006fdc 100644
--- a/src/network/networkd-sysctl.c
+++ b/src/network/networkd-sysctl.c
@@ -1,8 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <net/if_arp.h>
#include <netinet/in.h>
#include <linux/if.h>
-#include <linux/if_arp.h>
#include "af-list.h"
#include "missing_network.h"
diff --git a/src/network/test-network-tables.c b/src/network/test-network-tables.c
index f4e14c6d9b30..bc8378c9c946 100644
--- a/src/network/test-network-tables.c
+++ b/src/network/test-network-tables.c
@@ -2,6 +2,7 @@
/* Make sure the net/if.h header is included before any linux/ one */
#include <net/if.h>
+#include <net/ethernet.h>
#include <linux/if.h>
#include "bond.h"
diff --git a/src/shared/ethtool-util.c b/src/shared/ethtool-util.c
index 1e100c35ef53..2a28b14d6fc5 100644
--- a/src/shared/ethtool-util.c
+++ b/src/shared/ethtool-util.c
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <net/if.h>
+#include <netinet/if_ether.h>
#include <sys/ioctl.h>
#include <linux/ethtool.h>
#include <linux/netdevice.h>
diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
index 8adc2c89c814..393db78123ca 100644
--- a/src/shared/netif-util.c
+++ b/src/shared/netif-util.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <net/if_arp.h>
#include <linux/if.h>
-#include <linux/if_arp.h>
#include "arphrd-util.h"
#include "device-util.h"
diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
index 15b799775043..00072979111a 100644
--- a/src/test/test-arphrd-util.c
+++ b/src/test/test-arphrd-util.c
@@ -2,7 +2,7 @@
/* Make sure the net/if.h header is included before any linux/ one */
#include <net/if.h>
-#include <linux/if_arp.h>
+#include <net/if_arp.h>
#include "arphrd-util.h"
#include "string-util.h"
diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
index 647cdeeb9dba..0325cb3a8e97 100644
--- a/src/udev/net/link-config.c
+++ b/src/udev/net/link-config.c
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <netinet/if_ether.h>
#include <linux/netdevice.h>
#include <netinet/ether.h>
#include <unistd.h>
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index 384a1f31cbc4..2c97e9651eda 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -14,12 +14,13 @@
/* Make sure the net/if.h header is included before any linux/ one */
#include <net/if.h>
+#include <net/if_arp.h>
+#include <netinet/if_ether.h>
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <unistd.h>
#include <linux/if.h>
-#include <linux/if_arp.h>
#include <linux/netdevice.h>
#include <linux/pci_regs.h>
--
2.41.0