naccyde / rpms / iproute

Forked from rpms/iproute 5 months ago
Clone

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

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