From 8324ef421373c84b5034bf47b84fe42d84b1032f Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 23 Jun 2025 16:08:37 +0900 Subject: [PATCH] musl: replace netinet/if_ether.h with our own implementation 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 | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/include/musl/netinet/if_ether.h diff --git a/src/include/musl/netinet/if_ether.h b/src/include/musl/netinet/if_ether.h new file mode 100644 index 00000000000..62f4ac03b31 --- /dev/null +++ b/src/include/musl/netinet/if_ether.h @@ -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 /* IWYU pragma: export */ +#include /* IWYU pragma: export */ +#include /* 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 -- 2.47.3