Skip to contentSkip to conversation

netcat-openbsd: depends on linux-headers >= 3.12

PATCH New Gaël PORTAY 3 participants 7 messages Nov 28, 2017 – Dec 31, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netcat-openbsd: depends on linux-headers >= 3.12

This debian fork of netcat includes the kernel UAPI inet6 header. This header conflicts with the existing libc inet header and causes redefinition of structures when they are both included.

The compiler raises the following error:

	/home/buildroot/build/instance-0/output/host/x86_64-buildroot-linux-gnu/sysroot/usr/include/linux/in6.h:30:8: error: redefinition of 'struct in6_addr' struct in6_addr {

From version 3.12 of linux, the kernel UAPI header has mechanisms in libc-compat.h to prevent such situations (see __UAPI_DEF_SOCKADDR_IN6 macros).

Unfortunately the build is broken when toolchains do not satisfy at least the linux headers condition (>= 3.12).

The package now depends on the toolchain headers at least 3.12.

---

Hi all,

This patch fixes the build issue[1] of the netcat-openbsd package for x86_64[2] on branch next. I assume it also fixes the mips64el issue[3].

It fixes the issue from a configuration point of view. I believe the issue cannot be solved. As explain in the commit message, the build is broken because the linux-headers must be at least 3.12.

I need your help to make sure my understanding of the issue is right.

This fork of netcat uses some linux features, and the linux uapi header must be included. It uses macros that are defined in the linux uapi header which are not defined in the libc header.

I have tested by installing a new version of the kernel header using the commands below.

	$ make BR2_DEFAULT_KERNEL_HEADERS=3.12 linux-headers 
	$ make netcat-openbsd-rebuild

And it worked.

Regards,
Gael

[1]: http://lists.busybox.net/pipermail/buildroot/2017-November/207809.html
[2]: http://autobuild.buildroot.net/results/3c42c1eadcbfc084a1e55bf1df0450aaf1f2139c/
[3]: http://autobuild.buildroot.net/results/de0dd8983243ee5d1fb189add8ce445177fb87c2/

 package/netcat-openbsd/Config.in | 1 +
 1 file changed, 1 insertion(+)
package/netcat-openbsd/Config.in +1 -0
index 6df87ec688..5c8823c2ef 100644
@@ -4,6 +4,7 @@ config BR2_PACKAGE_NETCAT_OPENBSD
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_TOOLCHAIN_USES_GLIBC
 	depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
+	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12
 	select BR2_PACKAGE_LIBBSD
 	help
 	  A simple Unix utility which reads and writes data across network
Signature · 1 line
2.15.0
#1 lore raw

PATCH 1/1 netcat-openbsd: depends on linux-headers >= 3.12

Baruch,

Since you have looked at a lot of different kernel headers related issues, what do you think about this one below?

Thanks!

Thomas

Quoted 65 lines · Ga?l PORTAY

This debian fork of netcat includes the kernel UAPI inet6 header. This header conflicts with the existing libc inet header and causes redefinition of structures when they are both included.

The compiler raises the following error:

	/home/buildroot/build/instance-0/output/host/x86_64-buildroot-linux-gnu/sysroot/usr/include/linux/in6.h:30:8: error: redefinition of 'struct in6_addr' struct in6_addr {

From version 3.12 of linux, the kernel UAPI header has mechanisms in libc-compat.h to prevent such situations (see __UAPI_DEF_SOCKADDR_IN6 macros).

Unfortunately the build is broken when toolchains do not satisfy at least the linux headers condition (>= 3.12).

The package now depends on the toolchain headers at least 3.12.

---

Hi all,

This patch fixes the build issue[1] of the netcat-openbsd package for x86_64[2] on branch next. I assume it also fixes the mips64el issue[3].

It fixes the issue from a configuration point of view. I believe the issue cannot be solved. As explain in the commit message, the build is broken because the linux-headers must be at least 3.12.

I need your help to make sure my understanding of the issue is right.

This fork of netcat uses some linux features, and the linux uapi header must be included. It uses macros that are defined in the linux uapi header which are not defined in the libc header.

I have tested by installing a new version of the kernel header using the commands below.

	$ make BR2_DEFAULT_KERNEL_HEADERS=3.12 linux-headers 
	$ make netcat-openbsd-rebuild

And it worked.

Regards,
Gael

[1]: http://lists.busybox.net/pipermail/buildroot/2017-November/207809.html
[2]: http://autobuild.buildroot.net/results/3c42c1eadcbfc084a1e55bf1df0450aaf1f2139c/
[3]: http://autobuild.buildroot.net/results/de0dd8983243ee5d1fb189add8ce445177fb87c2/

 package/netcat-openbsd/Config.in | 1 +
 1 file changed, 1 insertion(+)
package/netcat-openbsd/Config.in +1 -0
index 6df87ec688..5c8823c2ef 100644
@@ -4,6 +4,7 @@ config BR2_PACKAGE_NETCAT_OPENBSD
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_TOOLCHAIN_USES_GLIBC
 	depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
+	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12
 	select BR2_PACKAGE_LIBBSD
 	help
 	  A simple Unix utility which reads and writes data across network
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 netcat-openbsd: depends on linux-headers >= 3.12

Hi Thomas,

Quoted 2 lines · Thomas Petazzoni

Since you have looked at a lot of different kernel headers related issues, what do you think about this one below?

Makes sense. We have faced the same issue with musl and iproute2. In each of these cases we used different solutions because both provide their own headers. For the simple case, it is reaonable to limit build to toolchains with newer kernel headers providing libc-compat.h.

baruch

Quoted 66 lines · Ga?l PORTAY
Quoted 65 lines

This debian fork of netcat includes the kernel UAPI inet6 header. This header conflicts with the existing libc inet header and causes redefinition of structures when they are both included.

The compiler raises the following error:

	/home/buildroot/build/instance-0/output/host/x86_64-buildroot-linux-gnu/sysroot/usr/include/linux/in6.h:30:8: error: redefinition of 'struct in6_addr' struct in6_addr {

From version 3.12 of linux, the kernel UAPI header has mechanisms in libc-compat.h to prevent such situations (see __UAPI_DEF_SOCKADDR_IN6 macros).

Unfortunately the build is broken when toolchains do not satisfy at least the linux headers condition (>= 3.12).

The package now depends on the toolchain headers at least 3.12.

---

Hi all,

This patch fixes the build issue[1] of the netcat-openbsd package for x86_64[2] on branch next. I assume it also fixes the mips64el issue[3].

It fixes the issue from a configuration point of view. I believe the issue cannot be solved. As explain in the commit message, the build is broken because the linux-headers must be at least 3.12.

I need your help to make sure my understanding of the issue is right.

This fork of netcat uses some linux features, and the linux uapi header must be included. It uses macros that are defined in the linux uapi header which are not defined in the libc header.

I have tested by installing a new version of the kernel header using the commands below.

	$ make BR2_DEFAULT_KERNEL_HEADERS=3.12 linux-headers 
	$ make netcat-openbsd-rebuild

And it worked.

Regards,
Gael

[1]: http://lists.busybox.net/pipermail/buildroot/2017-November/207809.html
[2]: http://autobuild.buildroot.net/results/3c42c1eadcbfc084a1e55bf1df0450aaf1f2139c/
[3]: http://autobuild.buildroot.net/results/de0dd8983243ee5d1fb189add8ce445177fb87c2/

 package/netcat-openbsd/Config.in | 1 +
 1 file changed, 1 insertion(+)
package/netcat-openbsd/Config.in +1 -0
index 6df87ec688..5c8823c2ef 100644
@@ -4,6 +4,7 @@ config BR2_PACKAGE_NETCAT_OPENBSD
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_TOOLCHAIN_USES_GLIBC
 	depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
+	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12
 	select BR2_PACKAGE_LIBBSD
 	help
 	  A simple Unix utility which reads and writes data across network
Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
#3 lore raw

PATCH 1/1 netcat-openbsd: depends on linux-headers >= 3.12

Hello,

Quoted 10 lines · Baruch Siach
Quoted 2 lines · Thomas Petazzoni

Since you have looked at a lot of different kernel headers related issues, what do you think about this one below?

Makes sense. We have faced the same issue with musl and iproute2. In each of these cases we used different solutions because both provide their own headers. For the simple case, it is reaonable to limit build to toolchains with newer kernel headers providing libc-compat.h.

Well, what bothers me is that netcat is a fairly simple tool, so I find it odd that we restrict it to >= 3.12.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#4 lore raw

PATCH 1/1 netcat-openbsd: depends on linux-headers >= 3.12

Hi Thomas,

Quoted 11 lines · Thomas Petazzoni
Quoted 9 lines · Baruch Siach
Quoted 2 lines · Thomas Petazzoni

Since you have looked at a lot of different kernel headers related issues, what do you think about this one below?

Makes sense. We have faced the same issue with musl and iproute2. In each of these cases we used different solutions because both provide their own headers. For the simple case, it is reaonable to limit build to toolchains with newer kernel headers providing libc-compat.h.

Quoted 4 lines
Quoted 1 line

Well, what bothers me is that netcat is a fairly simple tool, so I find it odd that we restrict it to >= 3.12.

These header collisions are frequent in networking related packages. The awkward duplication of networking libc/kernel headers make it too easy to hit a collision. It is only since 3.12 that we have kind of solution, though far from ideal. As development is usually done on newer kernels, developers don't see hit these collisoins anymore. So we end up with code that only compiles with headers 3.12 or newer.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
#5 lore raw

PATCH 1/1 netcat-openbsd: depends on linux-headers >= 3.12

In reply to Thomas Petazzoni

Thomas,

Quoted 13 lines · Thomas Petazzoni

Hello,

Quoted 9 lines · Baruch Siach
Quoted 2 lines · Thomas Petazzoni

Since you have looked at a lot of different kernel headers related issues, what do you think about this one below?

Makes sense. We have faced the same issue with musl and iproute2. In each of these cases we used different solutions because both provide their own headers. For the simple case, it is reaonable to limit build to toolchains with newer kernel headers providing libc-compat.h.

Quoted 5 lines
Quoted 1 line

Well, what bothers me is that netcat is a fairly simple tool, so I find it odd that we restrict it to >= 3.12.

If you prefer, I can update debian patch to not include the kernel UAPI header.

It will compile, but this version of netcat will be "amputated" from ipv6 feature.

Gael

#6 lore raw

PATCH 1/1 netcat-openbsd: depends on linux-headers >= 3.12

In reply to Gaël PORTAY

Hello,

Quoted 12 lines · Ga?l PORTAY

This debian fork of netcat includes the kernel UAPI inet6 header. This header conflicts with the existing libc inet header and causes redefinition of structures when they are both included.

The compiler raises the following error:

	/home/buildroot/build/instance-0/output/host/x86_64-buildroot-linux-gnu/sysroot/usr/include/linux/in6.h:30:8: error: redefinition of 'struct in6_addr' struct in6_addr {

From version 3.12 of linux, the kernel UAPI header has mechanisms in libc-compat.h to prevent such situations (see __UAPI_DEF_SOCKADDR_IN6 macros).

Quoted 7 lines

Unfortunately the build is broken when toolchains do not satisfy at least the linux headers condition (>= 3.12).

The package now depends on the toolchain headers at least 3.12.

---

You forgot to update the Config.in comment, so I've done so, and applied your patch. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com