Factorize net/ethernet.h

Message ID 20260616233536.756589-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
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Test passed
redhat-pt-bot/TryBot-32bit success Build for i686
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Test passed

Commit Message

Samuel Thibault June 16, 2026, 11:35 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.
---
 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 +
 6 files changed, 4 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

Florian Weimer June 17, 2026, 8:36 a.m. UTC | #1
* Samuel Thibault:

> 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.

Do we want applications to include <net/if_ether.h>?  If not, this
should be a bits/ header, with the usual #error guard.

Thanks,
Florian
  
Samuel Thibault June 17, 2026, 5:56 p.m. UTC | #2
Florian Weimer, le mer. 17 juin 2026 10:36:59 +0200, a ecrit:
> * Samuel Thibault:
> 
> > 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.
> 
> Do we want applications to include <net/if_ether.h>?

That's a common thing on BSD systems, like the other net/if_*.h

Samuel
  
Samuel Thibault June 22, 2026, 8:50 p.m. UTC | #3
Hello,

Samuel Thibault, le mer. 17 juin 2026 19:56:42 +0200, a ecrit:
> Florian Weimer, le mer. 17 juin 2026 10:36:59 +0200, a ecrit:
> > * Samuel Thibault:
> > 
> > > 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.
> > 
> > Do we want applications to include <net/if_ether.h>?
> 
> That's a common thing on BSD systems, like the other net/if_*.h

So, do we prefer to hide it in bits/ on Linux? I see that dietlibc does
ship a net/if_ether.h on Linux.

Samuel
  
Florian Weimer June 26, 2026, 11:26 a.m. UTC | #4
* Samuel Thibault:

> Florian Weimer, le mer. 17 juin 2026 10:36:59 +0200, a ecrit:
>> * Samuel Thibault:
>> 
>> > 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.
>> 
>> Do we want applications to include <net/if_ether.h>?
>
> That's a common thing on BSD systems, like the other net/if_*.h

Okay, then this is probably the direction we should move in.

Would you please post a version of the patch with a NEWS entry?

Thanks,
Florian
  
Samuel Thibault June 28, 2026, 5 p.m. UTC | #5
Hello,

Florian Weimer, le ven. 26 juin 2026 13:26:54 +0200, a ecrit:
> > Florian Weimer, le mer. 17 juin 2026 10:36:59 +0200, a ecrit:
> >> * Samuel Thibault:
> >> 
> >> > 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.
> >> 
> >> Do we want applications to include <net/if_ether.h>?
> >
> > That's a common thing on BSD systems, like the other net/if_*.h
> 
> Okay, then this is probably the direction we should move in.
> 
> Would you please post a version of the patch with a NEWS entry?

I have done so.

Samuel
  

Patch

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 7d87888dab..5dbabe5928 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>