Message ID | 20230306124407.64511-1-amusil@redhat.com |
---|---|
State | Changes Requested |
Headers | show |
Series | [ovs-dev] dpctl: Fix flush-conntrack with datapath as argument | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | warning | apply and check: warning |
ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
ovsrobot/intel-ovs-compilation | success | test: success |
On 3/6/23 13:44, Ales Musil wrote: > 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. > > Signed-off-by: Ales Musil <amusil@redhat.com> > --- Hi, Ales. Could you, please, add a test for this use-case? Thanks. BTW, I noticed that we're missing documentation for the ct_flush datapath capability flag in vswitch/vswitch.xml. Could you also fix that? Should be a separate change. Best regards, Ilya Maximets. > lib/dpctl.c | 17 ++++++++--------- > 1 file changed, 8 insertions(+), 9 deletions(-) > > diff --git a/lib/dpctl.c b/lib/dpctl.c > index c501a0cd7..3539bed77 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; > @@ -1747,13 +1753,6 @@ dpctl_flush_conntrack(int argc, const char *argv[], > args--; > } > > - /* Report error if there is more than one unparsed argument. */ > - if (args > 1) { > - ds_put_cstr(&ds, "invalid arguments"); > - error = EINVAL; > - goto error; > - } > - > error = opt_dpif_open(argc, argv, dpctl_p, 5, &dpif); > if (error) { > dpctl_error(dpctl_p, error, "Cannot open dpif");
Bleep bloop. Greetings Ales Musil, I am a robot and I have tried out your patch. Thanks for your contribution. I encountered some error that I wasn't expecting. See the details below. checkpatch: ERROR: Inappropriate bracing around statement #28 FILE: lib/dpctl.c:1722: if (dp_arg_exists(argc, argv) ) { Lines checked: 58, Warnings: 0, Errors: 1 Please check this out. If you feel there has been an error, please email aconole@redhat.com Thanks, 0-day Robot
diff --git a/lib/dpctl.c b/lib/dpctl.c index c501a0cd7..3539bed77 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; @@ -1747,13 +1753,6 @@ dpctl_flush_conntrack(int argc, const char *argv[], args--; } - /* Report error if there is more than one unparsed argument. */ - if (args > 1) { - ds_put_cstr(&ds, "invalid arguments"); - error = EINVAL; - goto error; - } - error = opt_dpif_open(argc, argv, dpctl_p, 5, &dpif); if (error) { dpctl_error(dpctl_p, error, "Cannot open dpif");
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. Signed-off-by: Ales Musil <amusil@redhat.com> --- lib/dpctl.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)