[ovs-dev] [PATCH ovs V8 21/26] dpctl: Add an option to dump only certain kinds of flows

Simon Horman simon.horman at netronome.com
Wed May 10 13:57:34 UTC 2017


On Wed, May 03, 2017 at 06:08:12PM +0300, Roi Dayan wrote:
> From: Paul Blakey <paulb at mellanox.com>
> 
> Usage:
>     # to dump all datapath flows (default):
>     ovs-dpctl dump-flows
> 
>     # to dump only flows that in kernel datapath:
>     ovs-dpctl dump-flows type=ovs
> 
>     # to dump only flows that are offloaded:
>     ovs-dpctl dump-flows type=offloaded

...

> diff --git a/lib/dpctl.c b/lib/dpctl.c
> index 11be857..f534de2 100644
> --- a/lib/dpctl.c
> +++ b/lib/dpctl.c

...

> @@ -774,22 +775,29 @@ dpctl_dump_flows(int argc, const char *argv[], struct dpctl_params *dpctl_p)
>      struct dpif_flow_dump *flow_dump;
>      struct dpif_flow f;
>      int pmd_id = PMD_ID_NULL;
> +    int lastargc = 0;
>      int error;
>  
> -    if (argc > 1 && !strncmp(argv[argc - 1], "filter=", 7)) {
> -        filter = xstrdup(argv[--argc] + 7);
> +    while (argc > 1 && lastargc != argc) {
> +        lastargc = argc;
> +        if (!strncmp(argv[argc - 1], "filter=", 7)) {
> +            filter = xstrdup(argv[--argc] + 7);
> +        } else if (!strncmp(argv[argc - 1], "type=", 5)) {
> +            type = xstrdup(argv[--argc] + 5);
> +        }

The above seems to have the presumably unintended side-effect of parsing
multiple filter= and type= arguments.

...


More information about the dev mailing list