Re: [PATCH] busybox tc doesn't compile with kernel 6.12.103

tito via busybox <[email protected]>
Newsgroups gmane.linux.busybox
Message-ID <20260813151632.75304007@devuan>
On Tue, 11 Aug 2026 10:20:26 +0200
tito via busybox <[email protected]> wrote:

> Hi,
> I've noticed that the tc applet doesn't compile with linux kernel  6.12.103
> and   git rev-parse --short HEAD
> 7473045ad
> 
> Ciao,
> Tito


Hi,
attached you will find a patch that allows busybox's tc applet to build with
Linux kernels greater than version 6.7 (and probably to run with
all kernels). This patch is only compile-tested and comes with a little
size increase for kernels 6.8+ that I was too lazy to measure).
Reviews, hints, critics and improvements by the list members are welcome.

Ciao,
Tito

Linux Kernel 6.8 has dropped CBQ support,
make busybox tc compile again.

Signed-off-by: Tito Ragusa <[email protected]>

--- networking/tc.c.orig	2026-03-22 08:20:28.681254128 +0100
+++ networking/tc.c	2026-08-13 14:48:07.588961828 +0200
@@ -61,6 +61,68 @@ enum
 #define TCA_PRIO_MAX    (__TCA_PRIO_MAX - 1)
 #endif
 
+#ifndef TC_CBQ_MAX
+#define TC_CBQ_MAXPRIO		8
+
+struct tc_cbq_lssopt {
+	unsigned char	change;
+	unsigned char	flags;
+#define TCF_CBQ_LSS_BOUNDED	1
+#define TCF_CBQ_LSS_ISOLATED	2
+	unsigned char  	ewma_log;
+	unsigned char  	level;
+#define TCF_CBQ_LSS_FLAGS	1
+#define TCF_CBQ_LSS_EWMA	2
+#define TCF_CBQ_LSS_MAXIDLE	4
+#define TCF_CBQ_LSS_MINIDLE	8
+#define TCF_CBQ_LSS_OFFTIME	0x10
+#define TCF_CBQ_LSS_AVPKT	0x20
+	__u32		maxidle;
+	__u32		minidle;
+	__u32		offtime;
+	__u32		avpkt;
+};
+
+struct tc_cbq_wrropt {
+	unsigned char	flags;
+	unsigned char	priority;
+	unsigned char	cpriority;
+	unsigned char	__reserved;
+	__u32		allot;
+	__u32		weight;
+};
+
+struct tc_cbq_ovl {
+	unsigned char	strategy;
+#define	TC_CBQ_OVL_CLASSIC	0
+#define	TC_CBQ_OVL_DELAY	1
+#define	TC_CBQ_OVL_LOWPRIO	2
+#define	TC_CBQ_OVL_DROP		3
+#define	TC_CBQ_OVL_RCLASSIC	4
+	unsigned char	priority2;
+	__u16		pad;
+	__u32		penalty;
+};
+
+struct tc_cbq_fopt {
+	__u32		split;
+	__u32		defmap;
+	__u32		defchange;
+};
+enum {
+	TCA_CBQ_UNSPEC,
+	TCA_CBQ_LSSOPT,
+	TCA_CBQ_WRROPT,
+	TCA_CBQ_FOPT,
+	TCA_CBQ_OVL_STRATEGY,
+	TCA_CBQ_RATE,
+	TCA_CBQ_RTAB,
+	TCA_CBQ_POLICE,
+	__TCA_CBQ_MAX,
+};
+#define TCA_CBQ_MAX	(__TCA_CBQ_MAX - 1)
+#endif
+
 #define parse_rtattr_nested(tb, max, rta) \
 	(parse_rtattr((tb), (max), RTA_DATA(rta), RTA_PAYLOAD(rta)))
 
@@ -242,6 +304,10 @@ static int cbq_print_opt(struct rtattr *
 	const char *const error = "CBQ: too short %s opt";
 	char buf[64];
 
+	if (get_linux_version_code() >= KERNEL_VERSION(6,8,0)) {
+		bb_info_msg("cbq is not supported");
+		goto done;
+	}
 	if (opt == NULL)
 		goto done;
 	parse_rtattr_nested(tb, TCA_CBQ_MAX, opt);

_______________________________________________
busybox mailing list
[email protected]
https://lists.busybox.net/mailman/listinfo/busybox
tc.patch (text/x-patch, 1.9 KB)
Linux Kernel 6.8 has dropped CBQ support,
make busybox tc compile again.

Signed-off-by: Tito Ragusa <[email protected]>

--- networking/tc.c.orig	2026-03-22 08:20:28.681254128 +0100
+++ networking/tc.c	2026-08-13 14:48:07.588961828 +0200
@@ -61,6 +61,68 @@ enum
 #define TCA_PRIO_MAX    (__TCA_PRIO_MAX - 1)
 #endif
 
+#ifndef TC_CBQ_MAX
+#define TC_CBQ_MAXPRIO		8
+
+struct tc_cbq_lssopt {
+	unsigned char	change;
+	unsigned char	flags;
+#define TCF_CBQ_LSS_BOUNDED	1
+#define TCF_CBQ_LSS_ISOLATED	2
+	unsigned char  	ewma_log;
+	unsigned char  	level;
+#define TCF_CBQ_LSS_FLAGS	1
+#define TCF_CBQ_LSS_EWMA	2
+#define TCF_CBQ_LSS_MAXIDLE	4
+#define TCF_CBQ_LSS_MINIDLE	8
+#define TCF_CBQ_LSS_OFFTIME	0x10
+#define TCF_CBQ_LSS_AVPKT	0x20
+	__u32		maxidle;
+	__u32		minidle;
+	__u32		offtime;
+	__u32		avpkt;
+};
+
+struct tc_cbq_wrropt {
+	unsigned char	flags;
+	unsigned char	priority;
+	unsigned char	cpriority;
+	unsigned char	__reserved;
+	__u32		allot;
+	__u32		weight;
+};
+
+struct tc_cbq_ovl {
+	unsigned char	strategy;
+#define	TC_CBQ_OVL_CLASSIC	0
+#define	TC_CBQ_OVL_DELAY	1
+#define	TC_CBQ_OVL_LOWPRIO	2
+#define	TC_CBQ_OVL_DROP		3
+#define	TC_CBQ_OVL_RCLASSIC	4
+	unsigned char	priority2;
+	__u16		pad;
+	__u32		penalty;
+};
+
+struct tc_cbq_fopt {
+	__u32		split;
+	__u32		defmap;
+	__u32		defchange;
+};
+enum {
+	TCA_CBQ_UNSPEC,
+	TCA_CBQ_LSSOPT,
+	TCA_CBQ_WRROPT,
+	TCA_CBQ_FOPT,
+	TCA_CBQ_OVL_STRATEGY,
+	TCA_CBQ_RATE,
+	TCA_CBQ_RTAB,
+	TCA_CBQ_POLICE,
+	__TCA_CBQ_MAX,
+};
+#define TCA_CBQ_MAX	(__TCA_CBQ_MAX - 1)
+#endif
+
 #define parse_rtattr_nested(tb, max, rta) \
 	(parse_rtattr((tb), (max), RTA_DATA(rta), RTA_PAYLOAD(rta)))
 
@@ -242,6 +304,10 @@ static int cbq_print_opt(struct rtattr *
 	const char *const error = "CBQ: too short %s opt";
 	char buf[64];
 
+	if (get_linux_version_code() >= KERNEL_VERSION(6,8,0)) {
+		bb_info_msg("cbq is not supported");
+		goto done;
+	}
 	if (opt == NULL)
 		goto done;
 	parse_rtattr_nested(tb, TCA_CBQ_MAX, opt);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.