All of lore.kernel.org
 help / color / mirror / Atom feed
From: Francois Romieu <romieu@fr.zoreil.com>
To: "Christian Pössinger" <christian@poessinger.com>
Cc: netdev@vger.kernel.org, Stephen Hemminger <stephen@networkplumber.org>
Subject: Re: iproute2/tc invalid JSON in 6.0.0 for flowid
Date: Thu, 13 Oct 2022 17:18:13 +0200	[thread overview]
Message-ID: <Y0gsNeByeUnTF3AT@electric-eye.fr.zoreil.com> (raw)
In-Reply-To: <f4806731521546b0bb7011b8c570b52b@poessinger.com>

Christian Pössinger <christian@poessinger.com> :
[...]
> If you can point me to the location which could be responsible for this issue, I am happy to submit a fix to the net tree.

If the completely untested patch below does not work, you may also
dig the bits in include/json_print.h and lib/json_print.c 

(Ccing Stephen as the unidentified "both" in README.devel)

diff --git a/tc/f_u32.c b/tc/f_u32.c
index d787eb91..70098bcd 100644
--- a/tc/f_u32.c
+++ b/tc/f_u32.c
@@ -1275,11 +1275,11 @@ static int u32_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt,
 		fprintf(stderr, "divisor and hash missing ");
 	}
 	if (tb[TCA_U32_CLASSID]) {
+		char *fmt = !sel || !(sel->flags & TC_U32_TERMINAL) ? "*flowid %s" : "flowid %s";
 		SPRINT_BUF(b1);
-		fprintf(f, "%sflowid %s ",
-			!sel || !(sel->flags & TC_U32_TERMINAL) ? "*" : "",
-			sprint_tc_classid(rta_getattr_u32(tb[TCA_U32_CLASSID]),
-					  b1));
+
+		print_string(PRINT_ANY, "flowid", fmt,
+			    sprint_tc_classid(rta_getattr_u32(tb[TCA_U32_CLASSID]), b1));
 	} else if (sel && sel->flags & TC_U32_TERMINAL) {
 		print_string(PRINT_FP, NULL, "terminal flowid ", NULL);
 	}

-- 
Ueimor

  reply	other threads:[~2022-10-13 15:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-13 11:17 iproute2/tc invalid JSON in 6.0.0 for flowid Christian Pössinger
2022-10-13 15:18 ` Francois Romieu [this message]
2022-10-13 15:43   ` Stephen Hemminger
2022-10-13 15:32 ` [PATCH iproute2] u32: fix json formatting of flowid Stephen Hemminger
2022-10-13 17:22   ` Christian Pössinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y0gsNeByeUnTF3AT@electric-eye.fr.zoreil.com \
    --to=romieu@fr.zoreil.com \
    --cc=christian@poessinger.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.