From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [iproute PATCH] tc: htb: Print default value in hex Date: Mon, 22 Oct 2018 09:56:23 -0700 Message-ID: <20181022095623.6ffabb31@xeon-e3> References: <20181019154255.25749-1-phil@nwl.cc> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Jiri Pirko , netdev@vger.kernel.org To: Phil Sutter Return-path: Received: from mail-pl1-f193.google.com ([209.85.214.193]:41910 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727669AbeJWBPn (ORCPT ); Mon, 22 Oct 2018 21:15:43 -0400 Received: by mail-pl1-f193.google.com with SMTP id p5-v6so4432891plq.8 for ; Mon, 22 Oct 2018 09:56:26 -0700 (PDT) In-Reply-To: <20181019154255.25749-1-phil@nwl.cc> Sender: netdev-owner@vger.kernel.org List-ID: On Fri, 19 Oct 2018 17:42:55 +0200 Phil Sutter wrote: > Value of 'default' is assumed to be hexadecimal when parsing, so > consequently it should be printed in hex as well. This is a regression > introduced when adding JSON output. > > Fixes: f354fa6aa5ff0 ("tc: jsonify htb qdisc") > Signed-off-by: Phil Sutter > --- > tc/q_htb.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tc/q_htb.c b/tc/q_htb.c > index c8b2941d945b7..c69485db8ef7d 100644 > --- a/tc/q_htb.c > +++ b/tc/q_htb.c > @@ -332,7 +332,7 @@ static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) > if (RTA_PAYLOAD(tb[TCA_HTB_INIT]) < sizeof(*gopt)) return -1; > > print_int(PRINT_ANY, "r2q", "r2q %d", gopt->rate2quantum); > - print_uint(PRINT_ANY, "default", " default %u", gopt->defcls); > + print_uint(PRINT_ANY, "default", " default %x", gopt->defcls); > print_uint(PRINT_ANY, "direct_packets_stat", > " direct_packets_stat %u", gopt->direct_pkts); > if (show_details) { The output should be in hex. Because you used print_uint it will still be in decimal in the JSON output. The correct fix here is to use print_0xhex instead. Please fix that, test it, and resubmit.