Re: [PATCH iproute2 v3 1/2] tc: u32: add support for json output
From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2022-01-25 07:04:48
On Mon, 24 Jan 2022 22:30:21 +0100 Andrea Claudi [off-list ref] wrote:
On Mon, Jan 24, 2022 at 10:50:16AM -0800, Stephen Hemminger wrote:quoted
On Mon, 24 Jan 2022 19:25:06 +0100 Andrea Claudi [off-list ref] wrote:quoted
On Thu, Jan 06, 2022 at 02:30:13PM -0800, Stephen Hemminger wrote:quoted
On Thu, 6 Jan 2022 13:45:51 -0500 Wen Liang [off-list ref] wrote:quoted
} else if (sel && sel->flags & TC_U32_TERMINAL) { - fprintf(f, "terminal flowid ??? "); + print_bool(PRINT_ANY, "terminal_flowid", "terminal flowid ??? ", true);This looks like another error (ie to stderr) like the earlier caseHi Stephen, Sorry for coming to this so late, but this doesn't look like an error to me. As far as I can see, TC_U32_TERMINAL is set in this file together with CLASSID or when "action" or "policy" are used. The latter case should be the one that this else branch should catch. Now, "terminal flowid ???" looks to me like a message printed when we don't actually have a flowid to show, and indeed that is specified when this flag is set (see the comment at line 1169). As such this is probably more a useless log message, than an error one. If this is the case, we can probably maintain this message on the PRINT_FP output (only to not break script parsing this bit of info out there), and disregard this bit of info on the JSON output. What do you think? Regards, AndreaJust always put the same original message on stderr.Let me phrase my case better: I think the "terminal flowid" message should not be on stderr, as I don't think this is an error message. Indeed, "terminal flowid ???" is printed every time we use "action" or "policy" (see my previous email for details), even when no error is present and cls_u32 is working ok. In these cases, not having a flowid is legitimate and not an error. As this is the case, I think the proper course of action is to have this message printed out only in non-json output to preserve the same output of older iproute versions. It would be even better if we decide to remove this message altogether, as it is not adding any valuable info to the user.
Agree, I have never used this obscure corner of u32 so will defer to others. But the existing message is unhelpful and looks like a bug. The output should be clear and correct for both json and non-json cases; and any ??? kind of output should be reserved for cases where some bogus result is being returned by the kernel. Some version skew, or partial result of previous operation maybe.