|
|
Message-ID: <20250930133403.GD1827@brightrain.aerifal.cx>
Date: Tue, 30 Sep 2025 09:34:03 -0400
From: Rich Felker <dalias@...c.org>
To: Qi.Chen@...driver.com
Cc: musl@...ts.openwall.com
Subject: Re: [PATCH 2/2] include/netinet/if_ether.h: guard ethhdr
definition to better work with other header files
On Tue, Sep 30, 2025 at 10:45:38AM +0800, Qi.Chen@...driver.com wrote:
> From: Chen Qi <Qi.Chen@...driver.com>
>
> The unconditional definition of 'struct ethhdr' has the implicit
> requirement on this header file, that is, it needs to be included
> before other header files defining ethhdr.
>
> Signed-off-by: Chen Qi <Qi.Chen@...driver.com>
> ---
> include/netinet/if_ether.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/include/netinet/if_ether.h b/include/netinet/if_ether.h
> index b1646f6f..e5a1ebd0 100644
> --- a/include/netinet/if_ether.h
> +++ b/include/netinet/if_ether.h
> @@ -112,12 +112,14 @@
> #define ETH_P_XDSA 0x00F8
> #define ETH_P_MAP 0x00F9
>
> +#ifndef __UAPI_DEF_ETHHDR
> struct ethhdr {
> uint8_t h_dest[ETH_ALEN];
> uint8_t h_source[ETH_ALEN];
> uint16_t h_proto;
> };
> #define __UAPI_DEF_ETHHDR 0
> +#endif
>
> #include <net/ethernet.h>
> #include <net/if_arp.h>
> --
> 2.34.1
Defining a macro multiple times with the exact same token sequence as
its definition each time is not an error.
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.