lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <dcf044ba-232e-d486-3e19-c84b169ced00@netronome.com>
Date:   Thu, 25 Apr 2019 20:21:04 +0100
From:   Quentin Monnet <quentin.monnet@...ronome.com>
To:     Andrii Nakryiko <andriin@...com>, andrii.nakryiko@...il.com,
        kernel-team@...com, netdev@...r.kernel.org, bpf@...r.kernel.org,
        ast@...com, daniel@...earbox.net, yhs@...com,
        songliubraving@...com, kafai@...com, acme@...nel.org
Subject: Re: [PATCH v3 bpf-next 3/4] bpftool: add bash completions for btf
 command

2019-04-25 09:55 UTC-0700 ~ Andrii Nakryiko <andriin@...com>
> Add full support for btf command in bash-completion script.
> 
> Cc: Quentin Monnet <quentin.monnet@...ronome.com>
> Cc: Yonghong Song <yhs@...com>
> Cc: Alexei Starovoitov <ast@...com>
> Cc: Daniel Borkmann <daniel@...earbox.net>
> Signed-off-by: Andrii Nakryiko <andriin@...com>
> ---
>   tools/bpf/bpftool/bash-completion/bpftool | 46 +++++++++++++++++++++++
>   1 file changed, 46 insertions(+)
> 
> diff --git a/tools/bpf/bpftool/bash-completion/bpftool b/tools/bpf/bpftool/bash-completion/bpftool
> index 9f3ffe1e26ab..bca91d04ed35 100644
> --- a/tools/bpf/bpftool/bash-completion/bpftool
> +++ b/tools/bpf/bpftool/bash-completion/bpftool
> @@ -217,6 +217,7 @@ _bpftool()
>       done
>       cur=${words[cword]}
>       prev=${words[cword - 1]}
> +    pprev=${words[cword - 2]}
>   
>       local object=${words[1]} command=${words[2]}
>   
> @@ -607,6 +608,51 @@ _bpftool()
>                       ;;
>               esac
>               ;;
> +        btf)
> +            local PROG_TYPE='id pinned tag'
> +            local MAP_TYPE='id pinned'
> +            case $command in
> +                dump)
> +                    case $prev in
> +                        $command)
> +                            COMPREPLY+=( $( compgen -W "id map prog file" -- \
> +                                "$cur" ) )
> +                            return 0
> +                            ;;
> +                        prog)
> +                            COMPREPLY=( $( compgen -W "$PROG_TYPE" -- "$cur" ) )
> +                            return 0
> +                            ;;
> +                        map)
> +                            COMPREPLY=( $( compgen -W "$MAP_TYPE" -- "$cur" ) )
> +                            return 0
> +                            ;;
> +                        id)
> +                            case $pprev in
> +                                prog)
> +                                    _bpftool_get_prog_ids
> +                                    ;;
> +                                map)
> +                                    _bpftool_get_map_ids
> +                                    ;;
> +                            esac
> +                            return 0
> +                            ;;
> +                        *)
> +                            if [[ $cword == 6 ]] && [[ ${words[3]} == "map" ]]; then
> +                                 COMPREPLY+=( $( compgen -W 'key value kv all' -- \
> +                                     "$cur" ) )
> +                            fi
> +                            return 0
> +                            ;;
> +                    esac
> +                    ;;
> +                *)
> +                    [[ $prev == $object ]] && \
> +                        COMPREPLY=( $( compgen -W 'dump help' -- "$cur" ) )
> +                    ;;
> +            esac
> +            ;;
>           cgroup)
>               case $command in
>                   show|list)
> 

I haven't tried with the latest change, but the code looks good to me. 
Thanks!

Reviewed-by: Quentin Monnet <quentin.monnet@...ronome.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ