From: Vladimir Oltean Date: Wed, 5 Jul 2023 10:51:55 +0000 (+0300) Subject: tc/taprio: fix parsing of "fp" option when it doesn't appear last X-Git-Tag: v6.5.0~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e848ef0ad5d07034ed08745eefec37586887a454;p=thirdparty%2Fiproute2.git tc/taprio: fix parsing of "fp" option when it doesn't appear last When installing a Qdisc this way: tc qdisc replace dev $ifname handle 8001: parent root stab overhead 24 taprio \ num_tc 8 \ map 0 1 2 3 4 5 6 7 \ queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 \ base-time 0 \ sched-entry S 01 1216 \ sched-entry S fe 12368 \ fp P E E E E E E E \ flags 0x2 the parser will error out when it tries to parse the "fp" array and it finds "flags" as one of the elements, expecting it to be one of "P" or "E". The way this is handled in the parsing of other array arguments of variable size (max-sdu, map, queues etc) is to not fail, call PREV_ARG() and attempt re-parsing the argument as something else. Do that for "fp" as well. Apparently mqprio handles this case correctly, so I must have forgotten to apply the same treatment for taprio as well, during development. Fixes: 5fbca3b469ec ("tc/taprio: add support for preemptible traffic classes") Signed-off-by: Vladimir Oltean Signed-off-by: Stephen Hemminger --- diff --git a/tc/q_taprio.c b/tc/q_taprio.c index 65d0a30bd..913197f68 100644 --- a/tc/q_taprio.c +++ b/tc/q_taprio.c @@ -250,10 +250,8 @@ static int taprio_parse_opt(struct qdisc_util *qu, int argc, } else if (strcmp(*argv, "P") == 0) { fp[idx] = TC_FP_PREEMPTIBLE; } else { - fprintf(stderr, - "Illegal \"fp\" value \"%s\", expected \"E\" or \"P\"\n", - *argv); - return -1; + PREV_ARG(); + break; } num_fp_entries++; idx++;