tools: ynl: add missing header deps
Subsystems (3)
Jakub Kicinski
maintainerPATCH 1/1 tools: ynl: add missing header deps
Various new families and my recent work on rtnetlink missed adding dependencies on C headers. If the system headers are up to date or don't include a given header at all this doesn't make a difference. But if the system headers are in place but stale - compilation will break.
---
CC: [email protected]
CC: [email protected]
--- tools/net/ynl/Makefile.deps | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/net/ynl/Makefile.deps +4 -1
@@ -20,15 +20,18 @@ CFLAGS_ethtool:=$(call get_hdr_inc,_LINUX_ETHTOOL_H,ethtool.h) \ $(call get_hdr_inc,_LINUX_ETHTOOL_NETLINK_H_,ethtool_netlink.h) \ $(call get_hdr_inc,_LINUX_ETHTOOL_NETLINK_GENERATED_H,ethtool_netlink_generated.h) CFLAGS_handshake:=$(call get_hdr_inc,_LINUX_HANDSHAKE_H,handshake.h) +CFLAGS_lockd_netlink:=$(call get_hdr_inc,_LINUX_LOCKD_NETLINK_H,lockd_netlink.h) CFLAGS_mptcp_pm:=$(call get_hdr_inc,_LINUX_MPTCP_PM_H,mptcp_pm.h) CFLAGS_net_shaper:=$(call get_hdr_inc,_LINUX_NET_SHAPER_H,net_shaper.h) CFLAGS_netdev:=$(call get_hdr_inc,_LINUX_NETDEV_H,netdev.h) CFLAGS_nl80211:=$(call get_hdr_inc,__LINUX_NL802121_H,nl80211.h) CFLAGS_nlctrl:=$(call get_hdr_inc,__LINUX_GENERIC_NETLINK_H,genetlink.h) CFLAGS_nfsd:=$(call get_hdr_inc,_LINUX_NFSD_NETLINK_H,nfsd_netlink.h) +CFLAGS_ovpn:=$(call get_hdr_inc,_LINUX_OVPN,ovpn.h) CFLAGS_ovs_datapath:=$(call get_hdr_inc,__LINUX_OPENVSWITCH_H,openvswitch.h) CFLAGS_ovs_flow:=$(call get_hdr_inc,__LINUX_OPENVSWITCH_H,openvswitch.h) CFLAGS_ovs_vport:=$(call get_hdr_inc,__LINUX_OPENVSWITCH_H,openvswitch.h) -CFLAGS_rt-addr:=$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) +CFLAGS_rt-addr:=$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) \ + $(call get_hdr_inc,__LINUX_IF_ADDR_H,if_addr.h) CFLAGS_rt-route:=$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) CFLAGS_tcp_metrics:=$(call get_hdr_inc,_LINUX_TCP_METRICS_H,tcp_metrics.h)
Signature · 1 line
2.49.0
Quoted 31 lines · Jakub Kicinski
Various new families and my recent work on rtnetlink missed adding dependencies on C headers. If the system headers are up to date or don't include a given header at all this doesn't make a difference. But if the system headers are in place but stale - compilation will break.
Reported-by Kory Maincent <[email protected]>Fixes 29d34a4d785b ("tools: ynl: generate code for rt-addr and add a sample")Signed-off-by Jakub Kicinski <[email protected]>---
CC: [email protected]
CC: [email protected]--- tools/net/ynl/Makefile.deps | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)tools/net/ynl/Makefile.deps +1
-0@@ -20,15 +20,18 @@ CFLAGS_ethtool:=$(call get_hdr_inc,_LINUX_ETHTOOL_H,ethtool.h) \ $(call get_hdr_inc,_LINUX_ETHTOOL_NETLINK_H_,ethtool_netlink.h) \ $(call get_hdr_inc,_LINUX_ETHTOOL_NETLINK_GENERATED_H,ethtool_netlink_generated.h) CFLAGS_handshake:=$(call get_hdr_inc,_LINUX_HANDSHAKE_H,handshake.h) +CFLAGS_lockd_netlink:=$(call get_hdr_inc,_LINUX_LOCKD_NETLINK_H,lockd_netlink.h) CFLAGS_mptcp_pm:=$(call get_hdr_inc,_LINUX_MPTCP_PM_H,mptcp_pm.h) CFLAGS_net_shaper:=$(call get_hdr_inc,_LINUX_NET_SHAPER_H,net_shaper.h) CFLAGS_netdev:=$(call get_hdr_inc,_LINUX_NETDEV_H,netdev.h) CFLAGS_nl80211:=$(call get_hdr_inc,__LINUX_NL802121_H,nl80211.h) CFLAGS_nlctrl:=$(call get_hdr_inc,__LINUX_GENERIC_NETLINK_H,genetlink.h)
tools/net/ynl/Makefile.deps CFLAGS_ethtool:=$(call get_hdr_inc,_LINUX_ETHTOOL_H,ethtool.h) \ · line 37
Quoted 10 lines
tools/net/ynl/Makefile.deps +3
-1CFLAGS_nfsd:=$(call get_hdr_inc,_LINUX_NFSD_NETLINK_H,nfsd_netlink.h) +CFLAGS_ovpn:=$(call get_hdr_inc,_LINUX_OVPN,ovpn.h) CFLAGS_ovs_datapath:=$(call get_hdr_inc,__LINUX_OPENVSWITCH_H,openvswitch.h) CFLAGS_ovs_flow:=$(call get_hdr_inc,__LINUX_OPENVSWITCH_H,openvswitch.h) CFLAGS_ovs_vport:=$(call get_hdr_inc,__LINUX_OPENVSWITCH_H,openvswitch.h) -CFLAGS_rt-addr:=$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) +CFLAGS_rt-addr:=$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) \ + $(call get_hdr_inc,__LINUX_IF_ADDR_H,if_addr.h) CFLAGS_rt-route:=$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) CFLAGS_tcp_metrics:=$(call get_hdr_inc,_LINUX_TCP_METRICS_H,tcp_metrics.h)
(mostly checked that XXX_H defines listed here match the ones in the header files)
Quoted 10 lines · On Fri, 18 Apr 2025 16:49:42 -0700 Jakub Kicinski <[email protected]> wrote:
Various new families and my recent work on rtnetlink missed adding dependencies on C headers. If the system headers are up to date or don't include a given header at all this doesn't make a difference. But if the system headers are in place but stale - compilation will break.
Reported-by Kory Maincent <[email protected]>Fixes 29d34a4d785b ("tools: ynl: generate code for rt-addr and add a sample")Signed-off-by Jakub Kicinski <[email protected]>
Thank you!
Signature · 3 lines
Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com
Quoted 18 lines
-----Original Message-----
From: Jakub Kicinski <[email protected]>
Sent: Friday, April 18, 2025 4:50 PM
To: [email protected]
Cc: [email protected]; Dumazet, Eric <[email protected]>; [email protected]; [email protected]; [email protected]; Jakub Kicinski <[email protected]>; Kory Maincent <[email protected]>; [email protected]; Keller, Jacob E <[email protected]>
Subject: [PATCH net-next] tools: ynl: add missing header depsVarious new families and my recent work on rtnetlink missed adding dependencies on C headers. If the system headers are up to date or don't include a given header at all this doesn't make a difference. But if the system headers are in place but stale - compilation will break.
Quoted 8 lines
Reported-by Kory Maincent <[email protected]>Fixes 29d34a4d785b ("tools: ynl: generate code for rt-addr and add a sample")Signed-off-by Jakub Kicinski <[email protected]>---
CC: [email protected]
CC: [email protected]
---
Quoted 35 lines
tools/net/ynl/Makefile.deps | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)tools/net/ynl/Makefile.deps +0
-0@@ -20,15 +20,18 @@ CFLAGS_ethtool:=$(call get_hdr_inc,_LINUX_ETHTOOL_H,ethtool.h) \ $(call get_hdr_inc,_LINUX_ETHTOOL_NETLINK_H_,ethtool_netlink.h) \ $(callget_hdr_inc,_LINUX_ETHTOOL_NETLINK_GENERATED_H,ethtool_netlink_generate
d.h)
CFLAGS_handshake:=$(call get_hdr_inc,_LINUX_HANDSHAKE_H,handshake.h)
+CFLAGS_lockd_netlink:=$(call get_hdr_inc,_LINUX_LOCKD_NETLINK_H,lockd_netlink.h)
CFLAGS_mptcp_pm:=$(call get_hdr_inc,_LINUX_MPTCP_PM_H,mptcp_pm.h) CFLAGS_net_shaper:=$(call get_hdr_inc,_LINUX_NET_SHAPER_H,net_shaper.h) CFLAGS_netdev:=$(call get_hdr_inc,_LINUX_NETDEV_H,netdev.h) CFLAGS_nl80211:=$(call get_hdr_inc,__LINUX_NL802121_H,nl80211.h) CFLAGS_nlctrl:=$(call get_hdr_inc,__LINUX_GENERIC_NETLINK_H,genetlink.h) CFLAGS_nfsd:=$(call get_hdr_inc,_LINUX_NFSD_NETLINK_H,nfsd_netlink.h)
+CFLAGS_ovpn:=$(call get_hdr_inc,_LINUX_OVPN,ovpn.h)
CFLAGS_ovs_datapath:=$(call
get_hdr_inc,__LINUX_OPENVSWITCH_H,openvswitch.h)
CFLAGS_ovs_flow:=$(call get_hdr_inc,__LINUX_OPENVSWITCH_H,openvswitch.h) CFLAGS_ovs_vport:=$(call
get_hdr_inc,__LINUX_OPENVSWITCH_H,openvswitch.h)tools/net/ynl/Makefile.deps +2
-2-CFLAGS_rt-addr:=$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) +CFLAGS_rt-addr:=$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) \ + $(call get_hdr_inc,__LINUX_IF_ADDR_H,if_addr.h) CFLAGS_rt-route:=$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) CFLAGS_tcp_metrics:=$(call get_hdr_inc,_LINUX_TCP_METRICS_H,tcp_metrics.h) --2.49.0
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 6 lines · On Fri, 18 Apr 2025 16:49:42 -0700 you wrote:
Various new families and my recent work on rtnetlink missed adding dependencies on C headers. If the system headers are up to date or don't include a given header at all this doesn't make a difference. But if the system headers are in place but stale - compilation will break.
Quoted 6 lines
Reported-by Kory Maincent <[email protected]>Fixes 29d34a4d785b ("tools: ynl: generate code for rt-addr and add a sample")Signed-off-by Jakub Kicinski <[email protected]>[...]
Here is the summary with links:
- [net-next] tools: ynl: add missing header deps
https://git.kernel.org/netdev/net-next/c/12b196568a3a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Quoted 11 lines · Jakub Kicinski
Various new families and my recent work on rtnetlink missed adding dependencies on C headers. If the system headers are up to date or don't include a given header at all this doesn't make a difference. But if the system headers are in place but stale - compilation will break.
Reported-by Kory Maincent <[email protected]>Fixes 29d34a4d785b ("tools: ynl: generate code for rt-addr and add a sample")Signed-off-by Jakub Kicinski <[email protected]>---
Lo! I ran into a ynl build error today and I wonder if I'm doing something wrong or if something is wrong with this or an related patch that recently landed in -next.
I'm building -next rpms daily for Fedora using a .spec file that is pretty close to the one Fedora uses. Everything worked fine yesterday, when this patch showed up in -next. Today's build failed like this:
"""
+ pushd tools/net/ynl
~/build/BUILD/kernel-next-20250423/linux-6.15.0-0.0.next.20250423.130.vanilla.fc40.x86_64/tools/net/ynl ~/build/BUILD/kernel-next-20250423/linux-6.15.0-0.0.next.20250423.130.vanilla.fc40.x86_64
+ export PIP_CONFIG_FILE=/tmp/pip.config
+ PIP_CONFIG_FILE=/tmp/pip.config
+ cat
+ CFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection '
+ LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes '
+ EXTRA_CFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection '
+ /usr/bin/make -s 'HOSTCFLAGS=-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection ' 'HOSTLDFLAGS=-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes ' -s -j32 DESTDIR=/builddir/build/BUILDROOT/kernel-6.15.0-0.0.next.20250423.130.vanilla.fc40.x86_64 install
GEN devlink-user.c
[...]
CC ethtool-user.o
In file included from ovpn-user.h:12,
from ovpn-user.c:8:
/usr/include/linux/ovpn.h:14:6: error: redeclaration of ‘enum ovpn_cipher_alg’
14 | enum ovpn_cipher_alg {
| ^~~~~~~~~~~~~~~
In file included from <command-line>:
./../../../../include/uapi//linux/ovpn.h:14:6: note: originally defined here
14 | enum ovpn_cipher_alg {
| ^~~~~~~~~~~~~~~
/usr/include/linux/ovpn.h:15:9: error: redeclaration of enumerator ‘OVPN_CIPHER_ALG_NONE’
15 | OVPN_CIPHER_ALG_NONE,
| ^~~~~~~~~~~~~~~~~~~~
./../../../../include/uapi//linux/ovpn.h:15:9: note: previous definition of ‘OVPN_CIPHER_ALG_NONE’ with type ‘enum ovpn_cipher_alg’
15 | OVPN_CIPHER_ALG_NONE,
| ^~~~~~~~~~~~~~~~~~~~
/usr/include/linux/ovpn.h:16:9: error: redeclaration of enumerator ‘OVPN_CIPHER_ALG_AES_GCM’
16 | OVPN_CIPHER_ALG_AES_GCM,
| ^~~~~~~~~~~~~~~~~~~~~~~
./../../../../include/uapi//linux/ovpn.h:16:9: note: previous definition of ‘OVPN_CIPHER_ALG_AES_GCM’ with type ‘enum ovpn_cipher_alg’
16 | OVPN_CIPHER_ALG_AES_GCM,
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/linux/ovpn.h:17:9: error: redeclaration of enumerator ‘OVPN_CIPHER_ALG_CHACHA20_POLY1305’
17 | OVPN_CIPHER_ALG_CHACHA20_POLY1305,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../../../../include/uapi//linux/ovpn.h:17:9: note: previous definition of ‘OVPN_CIPHER_ALG_CHACHA20_POLY1305’ with type ‘enum ovpn_cipher_alg’
17 | OVPN_CIPHER_ALG_CHACHA20_POLY1305,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[...]
"""
Full log (with a lot more similar errors):
https://download.copr.fedorainfracloud.org/results/@kernel-vanilla/next/fedora-40-x86_64/08955038-next-next-all/builder-live.log.gz
I wondered why this started to happen today instead of yesterday -- and it turns out that's because the build approach I use installed the kernel-headers package (the one that contains the files that end up in /usr/include/ ) from yesterday -next build. So I guess the same problem could happen to other people as well once they install new enough headers; at the same time I wonder if the kernel.spec file from Fedora is doing something wrong/stupid that causes this problem to happen.
Does anyone know why this problem occurs? If not I guess I have to investigate myself, but I thought it was worth asking here first.
Ciao, Thorsten
Quoted 27 lines
tools/net/ynl/Makefile.deps | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)tools/net/ynl/Makefile.deps +4
-1@@ -20,15 +20,18 @@ CFLAGS_ethtool:=$(call get_hdr_inc,_LINUX_ETHTOOL_H,ethtool.h) \ $(call get_hdr_inc,_LINUX_ETHTOOL_NETLINK_H_,ethtool_netlink.h) \ $(call get_hdr_inc,_LINUX_ETHTOOL_NETLINK_GENERATED_H,ethtool_netlink_generated.h) CFLAGS_handshake:=$(call get_hdr_inc,_LINUX_HANDSHAKE_H,handshake.h) +CFLAGS_lockd_netlink:=$(call get_hdr_inc,_LINUX_LOCKD_NETLINK_H,lockd_netlink.h) CFLAGS_mptcp_pm:=$(call get_hdr_inc,_LINUX_MPTCP_PM_H,mptcp_pm.h) CFLAGS_net_shaper:=$(call get_hdr_inc,_LINUX_NET_SHAPER_H,net_shaper.h) CFLAGS_netdev:=$(call get_hdr_inc,_LINUX_NETDEV_H,netdev.h) CFLAGS_nl80211:=$(call get_hdr_inc,__LINUX_NL802121_H,nl80211.h) CFLAGS_nlctrl:=$(call get_hdr_inc,__LINUX_GENERIC_NETLINK_H,genetlink.h) CFLAGS_nfsd:=$(call get_hdr_inc,_LINUX_NFSD_NETLINK_H,nfsd_netlink.h) +CFLAGS_ovpn:=$(call get_hdr_inc,_LINUX_OVPN,ovpn.h) CFLAGS_ovs_datapath:=$(call get_hdr_inc,__LINUX_OPENVSWITCH_H,openvswitch.h) CFLAGS_ovs_flow:=$(call get_hdr_inc,__LINUX_OPENVSWITCH_H,openvswitch.h) CFLAGS_ovs_vport:=$(call get_hdr_inc,__LINUX_OPENVSWITCH_H,openvswitch.h) -CFLAGS_rt-addr:=$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) +CFLAGS_rt-addr:=$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) \ + $(call get_hdr_inc,__LINUX_IF_ADDR_H,if_addr.h) CFLAGS_rt-route:=$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) CFLAGS_tcp_metrics:=$(call get_hdr_inc,_LINUX_TCP_METRICS_H,tcp_metrics.h)
Jakub Kicinski
maintainerQuoted 1 line · On Wed, 23 Apr 2025 15:28:07 +0200 Thorsten Leemhuis wrote:
Does anyone know why this problem occurs?
I typo'ed the inclusion guard :( Will send this shortly:
tools/net/ynl/Makefile.deps +1 -1
@@ -27,7 +27,7 @@ CFLAGS_netdev:=$(call get_hdr_inc,_LINUX_NETDEV_H,netdev.h) CFLAGS_nl80211:=$(call get_hdr_inc,__LINUX_NL802121_H,nl80211.h) CFLAGS_nlctrl:=$(call get_hdr_inc,__LINUX_GENERIC_NETLINK_H,genetlink.h) CFLAGS_nfsd:=$(call get_hdr_inc,_LINUX_NFSD_NETLINK_H,nfsd_netlink.h) -CFLAGS_ovpn:=$(call get_hdr_inc,_LINUX_OVPN,ovpn.h) +CFLAGS_ovpn:=$(call get_hdr_inc,_LINUX_OVPN_H,ovpn.h) CFLAGS_ovs_datapath:=$(call get_hdr_inc,__LINUX_OPENVSWITCH_H,openvswitch.h) CFLAGS_ovs_flow:=$(call get_hdr_inc,__LINUX_OPENVSWITCH_H,openvswitch.h)