[libc-commits] [libc] [libc] Add macros and <linux/if_ether.h> include to <net/ethernet.h> (PR #242242)
via libc-commits
libc-commits at lists.llvm.org
Fri Nov 13 02:28:46 PST 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Pavel Labath (labath)
<details>
<summary>Changes</summary>
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
---
Full diff: https://github.com/llvm/llvm-project/pull/242242.diff
1 Files Affected:
- (modified) libc/include/net/ethernet.yaml (+17-2)
``````````diff
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: []
-
``````````
</details>
https://github.com/llvm/llvm-project/pull/242242
More information about the libc-commits
mailing list