Blame SOURCES/0009-tc-htb-improve-burst-error-messages.patch

d5a8e7
From 0b66dc13c157f4d34518c06dd774ef39be0df271 Mon Sep 17 00:00:00 2001
d5a8e7
Message-Id: <0b66dc13c157f4d34518c06dd774ef39be0df271.1628790091.git.aclaudi@redhat.com>
d5a8e7
In-Reply-To: <650694eb0120722499207078f965442ef7343bb1.1628790091.git.aclaudi@redhat.com>
d5a8e7
References: <650694eb0120722499207078f965442ef7343bb1.1628790091.git.aclaudi@redhat.com>
d5a8e7
From: Andrea Claudi <aclaudi@redhat.com>
d5a8e7
Date: Thu, 12 Aug 2021 18:26:39 +0200
d5a8e7
Subject: [PATCH] tc: htb: improve burst error messages
d5a8e7
d5a8e7
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1910745
d5a8e7
Upstream Status: iproute2.git commit e44786b2
d5a8e7
d5a8e7
commit e44786b26934e4fbf337b0af73a9e6f53d458a25
d5a8e7
Author: Andrea Claudi <aclaudi@redhat.com>
d5a8e7
Date:   Thu May 6 12:42:06 2021 +0200
d5a8e7
d5a8e7
    tc: htb: improve burst error messages
d5a8e7
d5a8e7
    When a wrong value is provided for "burst" or "cburst" parameters, the
d5a8e7
    resulting error message is unclear and can be misleading:
d5a8e7
d5a8e7
    $ tc class add dev dummy0 parent 1: classid 1:1 htb rate 100KBps burst errtrigger
d5a8e7
    Illegal "buffer"
d5a8e7
d5a8e7
    The message claims an illegal "buffer" is provided, but neither the
d5a8e7
    inline help nor the man page list "buffer" among the htb parameters, and
d5a8e7
    the only way to know that "burst", "maxburst" and "buffer" are synonyms
d5a8e7
    is to look into tc/q_htb.c.
d5a8e7
d5a8e7
    This commit tries to improve this simply changing the error string to
d5a8e7
    the parameter name provided in the user-given command, clearly pointing
d5a8e7
    out where the wrong value is.
d5a8e7
d5a8e7
    $ tc class add dev dummy0 parent 1: classid 1:1 htb rate 100KBps burst errtrigger
d5a8e7
    Illegal "burst"
d5a8e7
d5a8e7
    $ tc class add dev dummy0 parent 1: classid 1:1 htb rate 100Kbps maxburst errtrigger
d5a8e7
    Illegal "maxburst"
d5a8e7
d5a8e7
    Reported-by: Sebastian Mitterle <smitterl@redhat.com>
d5a8e7
    Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
d5a8e7
    Signed-off-by: David Ahern <dsahern@kernel.org>
d5a8e7
d5a8e7
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
d5a8e7
---
d5a8e7
 tc/q_htb.c | 7 +++++--
d5a8e7
 1 file changed, 5 insertions(+), 2 deletions(-)
d5a8e7
d5a8e7
diff --git a/tc/q_htb.c b/tc/q_htb.c
d5a8e7
index 42566355..b5f95f67 100644
d5a8e7
--- a/tc/q_htb.c
d5a8e7
+++ b/tc/q_htb.c
d5a8e7
@@ -125,6 +125,7 @@ static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
d5a8e7
 	unsigned int linklayer  = LINKLAYER_ETHERNET; /* Assume ethernet */
d5a8e7
 	struct rtattr *tail;
d5a8e7
 	__u64 ceil64 = 0, rate64 = 0;
d5a8e7
+	char *param;
d5a8e7
 
d5a8e7
 	while (argc > 0) {
d5a8e7
 		if (matches(*argv, "prio") == 0) {
d5a8e7
@@ -160,17 +161,19 @@ static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
d5a8e7
 		} else if (matches(*argv, "burst") == 0 ||
d5a8e7
 			   strcmp(*argv, "buffer") == 0 ||
d5a8e7
 			   strcmp(*argv, "maxburst") == 0) {
d5a8e7
+			param = *argv;
d5a8e7
 			NEXT_ARG();
d5a8e7
 			if (get_size_and_cell(&buffer, &cell_log, *argv) < 0) {
d5a8e7
-				explain1("buffer");
d5a8e7
+				explain1(param);
d5a8e7
 				return -1;
d5a8e7
 			}
d5a8e7
 		} else if (matches(*argv, "cburst") == 0 ||
d5a8e7
 			   strcmp(*argv, "cbuffer") == 0 ||
d5a8e7
 			   strcmp(*argv, "cmaxburst") == 0) {
d5a8e7
+			param = *argv;
d5a8e7
 			NEXT_ARG();
d5a8e7
 			if (get_size_and_cell(&cbuffer, &ccell_log, *argv) < 0) {
d5a8e7
-				explain1("cbuffer");
d5a8e7
+				explain1(param);
d5a8e7
 				return -1;
d5a8e7
 			}
d5a8e7
 		} else if (strcmp(*argv, "ceil") == 0) {
d5a8e7
-- 
d5a8e7
2.31.1
d5a8e7