diff options
author | Ales Musil <amusil@redhat.com> | 2023-03-13 08:16:34 +0100 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2023-03-15 21:24:14 +0100 |
commit | ebe98c587deb1bc011d9ec6263dc25bed9df0d3b (patch) | |
tree | 3ca4721f508e291ec7098fbd89bec2d232cfa55c /lib | |
parent | a4cd2afea5c3ba08f38379a7356ffb3bf5662d5c (diff) | |
download | openvswitch-ebe98c587deb1bc011d9ec6263dc25bed9df0d3b.tar.gz |
dpctl: Fix flush-conntrack with datapath as argument.
Specifying datapath with "dpctl/flush-conntrack" didn't
work as expected and caused error:
ovs-dpctl: field system@ovs-system missing value (Invalid argument)
To prevent that, check if we have datapath as first argument
and use it accordingly.
Also add couple of test cases to ensure that everything works as
expected.
Fixes: a9ae73b916ba ("ofp, dpif: Allow CT flush based on partial match.")
Signed-off-by: Ales Musil <amusil@redhat.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dpctl.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/dpctl.c b/lib/dpctl.c index c501a0cd7..59cc4f58c 100644 --- a/lib/dpctl.c +++ b/lib/dpctl.c @@ -1717,10 +1717,16 @@ dpctl_flush_conntrack(int argc, const char *argv[], uint16_t zone, *pzone = NULL; int error; int args = argc - 1; + int zone_pos = 1; + + if (dp_arg_exists(argc, argv)) { + args--; + zone_pos = 2; + } /* Parse zone. */ - if (args && !strncmp(argv[1], "zone=", 5)) { - if (!ovs_scan(argv[1], "zone=%"SCNu16, &zone)) { + if (args && !strncmp(argv[zone_pos], "zone=", 5)) { + if (!ovs_scan(argv[zone_pos], "zone=%"SCNu16, &zone)) { ds_put_cstr(&ds, "failed to parse zone"); error = EINVAL; goto error; @@ -1748,7 +1754,7 @@ dpctl_flush_conntrack(int argc, const char *argv[], } /* Report error if there is more than one unparsed argument. */ - if (args > 1) { + if (args > 0) { ds_put_cstr(&ds, "invalid arguments"); error = EINVAL; goto error; |