netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Francois Romieu <romieu@fr.zoreil.com>
Cc: "Christian Pössinger" <christian@poessinger.com>, netdev@vger.kernel.org
Subject: Re: iproute2/tc invalid JSON in 6.0.0 for flowid
Date: Thu, 13 Oct 2022 08:43:44 -0700	[thread overview]
Message-ID: <20221013084344.0fe8f3de@hermes.local> (raw)
In-Reply-To: <Y0gsNeByeUnTF3AT@electric-eye.fr.zoreil.com>

On Thu, 13 Oct 2022 17:18:13 +0200
Francois Romieu <romieu@fr.zoreil.com> wrote:

> 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);
>  	}
> 


Already sent patch.

  reply	other threads:[~2022-10-13 15:44 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
2022-10-13 15:43   ` Stephen Hemminger [this message]
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=20221013084344.0fe8f3de@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=christian@poessinger.com \
    --cc=netdev@vger.kernel.org \
    --cc=romieu@fr.zoreil.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).