[libc-commits] [libc] [libc] Add macros and <linux/if_ether.h> include to <net/ethernet.h> (PR #242242)
Pavel Labath via libc-commits
libc-commits at lists.llvm.org
Fri Nov 13 02:28:08 PST 2026
https://github.com/labath created https://github.com/llvm/llvm-project/pull/242242
This makes <net/ethernet.h> include <linux/if_ether.h> and adds definitions for the ETHER_* length macros:
- ETHER_ADDR_LEN
- ETHER_TYPE_LEN
- ETHER_CRC_LEN
- ETHER_HDR_LEN
- ETHER_MIN_LEN
- ETHER_MAX_LEN
- ETHER_MAX_LEN_JUMBO
I'm using public_includes for <linux/if_ether.h>. It is fine for now, since <net/ethernet.h> is currently only enabled on Linux. If that changes, we'll need to figure out what to do with it. I'd probably go with something declarative, like adding a 'guard:' field to the public_includes list.
Assisted-by: Gemini
>From c71c63aa8f719a386c9e4f81fad8e24a875eace8 Mon Sep 17 00:00:00 2001
From: Pavel Labath <pavel at labath.sk>
Date: Fri, 13 Nov 2026 10:21:29 +0000
Subject: [PATCH] [libc] Add macros and <linux/if_ether.h> include to
<net/ethernet.h>
This makes <net/ethernet.h> include <linux/if_ether.h> and adds
definitions for the ETHER_* length macros:
- ETHER_ADDR_LEN
- ETHER_TYPE_LEN
- ETHER_CRC_LEN
- ETHER_HDR_LEN
- ETHER_MIN_LEN
- ETHER_MAX_LEN
- ETHER_MAX_LEN_JUMBO
I'm using public_includes for <linux/if_ether.h>. It is fine for
now, since <net/ethernet.h> is currently only enabled on Linux.
If that changes, we'll need to figure out what to do with it. I'd
probably go with something declarative, like adding a 'guard:'
field to the public_includes list.
Assisted-by: Gemini
---
libc/include/net/ethernet.yaml | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/libc/include/net/ethernet.yaml b/libc/include/net/ethernet.yaml
index b6de7563f23ba..b5ffa06bd567d 100644
--- a/libc/include/net/ethernet.yaml
+++ b/libc/include/net/ethernet.yaml
@@ -1,10 +1,25 @@
header: net/ethernet.h
standards:
- bsd
-macros: []
+public_includes:
+ - linux/if_ether.h
+macros:
+ - macro_name: ETHER_ADDR_LEN
+ macro_value: 6
+ - macro_name: ETHER_TYPE_LEN
+ macro_value: 2
+ - macro_name: ETHER_CRC_LEN
+ macro_value: 4
+ - macro_name: ETHER_HDR_LEN
+ macro_value: 14
+ - macro_name: ETHER_MIN_LEN
+ macro_value: 64
+ - macro_name: ETHER_MAX_LEN
+ macro_value: 1518
+ - macro_name: ETHER_MAX_LEN_JUMBO
+ macro_value: 9018
types:
- type_name: struct_ether_addr
enums: []
objects: []
functions: []
-
More information about the libc-commits
mailing list