Factorize net/ethernet.h

Message ID 20260628165958.901310-1-samuel.thibault@ens-lyon.org (mailing list archive)
State New
Headers
Series Factorize net/ethernet.h |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
redhat-pt-bot/TryBot-32bit success Build for i686
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 fail Test failed

Commit Message

Samuel Thibault June 28, 2026, 4:59 p.m. UTC
  The Linux version is much more up to date, and is OS-independent.

This introduces net/if_ether.h which just pulls linux/if_ether.h, like
many other such compatibility headers.
---
 NEWS                                            | 3 +++
 sysdeps/gnu/Makefile                            | 2 +-
 sysdeps/{unix/sysv/linux => gnu}/net/ethernet.h | 2 +-
 sysdeps/{mach/hurd => gnu}/net/if_ether.h       | 0
 sysdeps/mach/hurd/Makefile                      | 2 +-
 sysdeps/unix/sysv/linux/Makefile                | 1 -
 sysdeps/unix/sysv/linux/net/if_ether.h          | 1 +
 7 files changed, 7 insertions(+), 4 deletions(-)
 rename sysdeps/{unix/sysv/linux => gnu}/net/ethernet.h (97%)
 rename sysdeps/{mach/hurd => gnu}/net/if_ether.h (100%)
 create mode 100644 sysdeps/unix/sysv/linux/net/if_ether.h
  

Comments

Samuel Thibault July 17, 2026, 5:02 p.m. UTC | #1
Hello,

I have not seen news on this, is it ok to commit?

With regards,
Samuel

Samuel Thibault, le dim. 28 juin 2026 18:59:58 +0200, a ecrit:
> The Linux version is much more up to date, and is OS-independent.
> 
> This introduces net/if_ether.h which just pulls linux/if_ether.h, like
> many other such compatibility headers.
> ---
>  NEWS                                            | 3 +++
>  sysdeps/gnu/Makefile                            | 2 +-
>  sysdeps/{unix/sysv/linux => gnu}/net/ethernet.h | 2 +-
>  sysdeps/{mach/hurd => gnu}/net/if_ether.h       | 0
>  sysdeps/mach/hurd/Makefile                      | 2 +-
>  sysdeps/unix/sysv/linux/Makefile                | 1 -
>  sysdeps/unix/sysv/linux/net/if_ether.h          | 1 +
>  7 files changed, 7 insertions(+), 4 deletions(-)
>  rename sysdeps/{unix/sysv/linux => gnu}/net/ethernet.h (97%)
>  rename sysdeps/{mach/hurd => gnu}/net/if_ether.h (100%)
>  create mode 100644 sysdeps/unix/sysv/linux/net/if_ether.h
> 
> diff --git a/NEWS b/NEWS
> index f9d90c5194..b7ac8bdf05 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -37,6 +37,9 @@ Major new features:
>    status via prctl syscall.  This prevents disabling or corrupting GCS
>    shadow stack during runtime.
>  
> +* The <net/if_ether.h> header is introduced to provide ethernet header
> +  constants and structure, like on BSD.
> +
>  Deprecated and removed features, and other changes affecting compatibility:
>  
>  * Although malloc and related functions currently return pointers
> diff --git a/sysdeps/gnu/Makefile b/sysdeps/gnu/Makefile
> index 2844d37fa0..fcac64abf3 100644
> --- a/sysdeps/gnu/Makefile
> +++ b/sysdeps/gnu/Makefile
> @@ -82,5 +82,5 @@ sysdep_headers += \
>  endif
>  
>  ifeq ($(subdir),socket)
> -sysdep_headers += net/if_arp.h
> +sysdep_headers += net/ethernet.h net/if_arp.h net/if_ether.h
>  endif
> diff --git a/sysdeps/unix/sysv/linux/net/ethernet.h b/sysdeps/gnu/net/ethernet.h
> similarity index 97%
> rename from sysdeps/unix/sysv/linux/net/ethernet.h
> rename to sysdeps/gnu/net/ethernet.h
> index b468b5b2c4..0f06c1fb24 100644
> --- a/sysdeps/unix/sysv/linux/net/ethernet.h
> +++ b/sysdeps/gnu/net/ethernet.h
> @@ -24,7 +24,7 @@
>  #include <sys/types.h>
>  #include <stdint.h>
>  
> -#include <linux/if_ether.h>     /* IEEE 802.3 Ethernet constants */
> +#include <net/if_ether.h>     /* IEEE 802.3 Ethernet constants */
>  
>  __BEGIN_DECLS
>  
> diff --git a/sysdeps/mach/hurd/net/if_ether.h b/sysdeps/gnu/net/if_ether.h
> similarity index 100%
> rename from sysdeps/mach/hurd/net/if_ether.h
> rename to sysdeps/gnu/net/if_ether.h
> diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile
> index a5027510af..f5885cfea0 100644
> --- a/sysdeps/mach/hurd/Makefile
> +++ b/sysdeps/mach/hurd/Makefile
> @@ -224,7 +224,7 @@ sysdep_headers += nfs/nfs.h
>  endif
>  
>  ifeq ($(subdir),socket)
> -sysdep_headers += net/ethernet.h net/if_ether.h net/route.h
> +sysdep_headers += net/route.h
>  endif
>  
>  ifeq ($(subdir),nis)
> diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
> index 1efeac5213..4dd5b0013c 100644
> --- a/sysdeps/unix/sysv/linux/Makefile
> +++ b/sysdeps/unix/sysv/linux/Makefile
> @@ -476,7 +476,6 @@ endif
>  ifeq ($(subdir),socket)
>  sysdep_headers += \
>    bits/socket-constants.h \
> -  net/ethernet.h \
>    net/if_packet.h \
>    net/if_ppp.h \
>    net/if_shaper.h \
> diff --git a/sysdeps/unix/sysv/linux/net/if_ether.h b/sysdeps/unix/sysv/linux/net/if_ether.h
> new file mode 100644
> index 0000000000..060ef22070
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/net/if_ether.h
> @@ -0,0 +1 @@
> +#include <linux/if_ether.h>
> -- 
> 2.53.0
>
  

Patch

diff --git a/NEWS b/NEWS
index f9d90c5194..b7ac8bdf05 100644
--- a/NEWS
+++ b/NEWS
@@ -37,6 +37,9 @@  Major new features:
   status via prctl syscall.  This prevents disabling or corrupting GCS
   shadow stack during runtime.
 
+* The <net/if_ether.h> header is introduced to provide ethernet header
+  constants and structure, like on BSD.
+
 Deprecated and removed features, and other changes affecting compatibility:
 
 * Although malloc and related functions currently return pointers
diff --git a/sysdeps/gnu/Makefile b/sysdeps/gnu/Makefile
index 2844d37fa0..fcac64abf3 100644
--- a/sysdeps/gnu/Makefile
+++ b/sysdeps/gnu/Makefile
@@ -82,5 +82,5 @@  sysdep_headers += \
 endif
 
 ifeq ($(subdir),socket)
-sysdep_headers += net/if_arp.h
+sysdep_headers += net/ethernet.h net/if_arp.h net/if_ether.h
 endif
diff --git a/sysdeps/unix/sysv/linux/net/ethernet.h b/sysdeps/gnu/net/ethernet.h
similarity index 97%
rename from sysdeps/unix/sysv/linux/net/ethernet.h
rename to sysdeps/gnu/net/ethernet.h
index b468b5b2c4..0f06c1fb24 100644
--- a/sysdeps/unix/sysv/linux/net/ethernet.h
+++ b/sysdeps/gnu/net/ethernet.h
@@ -24,7 +24,7 @@ 
 #include <sys/types.h>
 #include <stdint.h>
 
-#include <linux/if_ether.h>     /* IEEE 802.3 Ethernet constants */
+#include <net/if_ether.h>     /* IEEE 802.3 Ethernet constants */
 
 __BEGIN_DECLS
 
diff --git a/sysdeps/mach/hurd/net/if_ether.h b/sysdeps/gnu/net/if_ether.h
similarity index 100%
rename from sysdeps/mach/hurd/net/if_ether.h
rename to sysdeps/gnu/net/if_ether.h
diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile
index a5027510af..f5885cfea0 100644
--- a/sysdeps/mach/hurd/Makefile
+++ b/sysdeps/mach/hurd/Makefile
@@ -224,7 +224,7 @@  sysdep_headers += nfs/nfs.h
 endif
 
 ifeq ($(subdir),socket)
-sysdep_headers += net/ethernet.h net/if_ether.h net/route.h
+sysdep_headers += net/route.h
 endif
 
 ifeq ($(subdir),nis)
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 1efeac5213..4dd5b0013c 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -476,7 +476,6 @@  endif
 ifeq ($(subdir),socket)
 sysdep_headers += \
   bits/socket-constants.h \
-  net/ethernet.h \
   net/if_packet.h \
   net/if_ppp.h \
   net/if_shaper.h \
diff --git a/sysdeps/unix/sysv/linux/net/if_ether.h b/sysdeps/unix/sysv/linux/net/if_ether.h
new file mode 100644
index 0000000000..060ef22070
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/net/if_ether.h
@@ -0,0 +1 @@ 
+#include <linux/if_ether.h>