naccyde / rpms / iproute

Forked from rpms/iproute 8 months ago
Clone

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

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