]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
musl: replace netinet/if_ether.h with our own implementation
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 23 Jun 2025 07:08:37 +0000 (16:08 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 13 Nov 2025 19:59:03 +0000 (04:59 +0900)
musl's netinet/if_ether.h conflicts with linux/if_ether.h.
The reimplementation is mostly equivalent with what glibc does.

src/include/musl/netinet/if_ether.h [new file with mode: 0644]

diff --git a/src/include/musl/netinet/if_ether.h b/src/include/musl/netinet/if_ether.h
new file mode 100644 (file)
index 0000000..62f4ac0
--- /dev/null
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+/* glibc's netinet/if_ether.h does the following:
+ * - include linux/if_ether.h, net/ethernet.h, and net/if_arp.h,
+ * - define struct ether_arp, and relevant macros,
+ * - define ETHER_MAP_IP_MULTICAST() macro (currently we do not use it).
+ * However, musl's netinet/if_ether.h conflicts with linux/if_ether.h.
+ * Let's use the same way that glibc uses. */
+
+#include <linux/if_ether.h>     /* IWYU pragma: export */
+#include <net/ethernet.h>       /* IWYU pragma: export */
+#include <net/if_arp.h>         /* IWYU pragma: export */
+
+/*
+ * Ethernet Address Resolution Protocol.
+ *
+ * See RFC 826 for protocol description.  Structure below is adapted
+ * to resolving internet addresses.  Field names used correspond to
+ * RFC 826.
+ */
+struct  ether_arp {
+        struct  arphdr ea_hdr;          /* fixed-size header */
+        uint8_t arp_sha[ETH_ALEN];      /* sender hardware address */
+        uint8_t arp_spa[4];             /* sender protocol address */
+        uint8_t arp_tha[ETH_ALEN];      /* target hardware address */
+        uint8_t arp_tpa[4];             /* target protocol address */
+};
+#define arp_hrd ea_hdr.ar_hrd
+#define arp_pro ea_hdr.ar_pro
+#define arp_hln ea_hdr.ar_hln
+#define arp_pln ea_hdr.ar_pln
+#define arp_op  ea_hdr.ar_op