1. 24 8月, 2022 1 次提交
  2. 03 6月, 2021 1 次提交
  3. 11 9月, 2020 3 次提交
  4. 26 8月, 2020 1 次提交
  5. 25 6月, 2020 1 次提交
  6. 23 6月, 2020 2 次提交
  7. 17 6月, 2020 1 次提交
  8. 16 6月, 2020 1 次提交
  9. 02 6月, 2020 1 次提交
  10. 12 5月, 2020 1 次提交
  11. 13 3月, 2020 1 次提交
  12. 21 1月, 2020 1 次提交
  13. 16 1月, 2020 4 次提交
  14. 16 12月, 2019 1 次提交
  15. 22 8月, 2019 2 次提交
  16. 30 7月, 2019 1 次提交
  17. 06 6月, 2019 1 次提交
    • K
      tools: bpftool: Fix JSON output when lookup fails · 1884c066
      Krzesimir Nowak 提交于
      In commit 9a5ab8bf ("tools: bpftool: turn err() and info() macros
      into functions") one case of error reporting was special cased, so it
      could report a lookup error for a specific key when dumping the map
      element. What the code forgot to do is to wrap the key and value keys
      into a JSON object, so an example output of pretty JSON dump of a
      sockhash map (which does not support looking up its values) is:
      
      [
          "key": ["0x0a","0x41","0x00","0x02","0x1f","0x78","0x00","0x00"
          ],
          "value": {
              "error": "Operation not supported"
          },
          "key": ["0x0a","0x41","0x00","0x02","0x1f","0x78","0x00","0x01"
          ],
          "value": {
              "error": "Operation not supported"
          }
      ]
      
      Note the key-value pairs inside the toplevel array. They should be
      wrapped inside a JSON object, otherwise it is an invalid JSON. This
      commit fixes this, so the output now is:
      
      [{
              "key": ["0x0a","0x41","0x00","0x02","0x1f","0x78","0x00","0x00"
              ],
              "value": {
                  "error": "Operation not supported"
              }
          },{
              "key": ["0x0a","0x41","0x00","0x02","0x1f","0x78","0x00","0x01"
              ],
              "value": {
                  "error": "Operation not supported"
              }
          }
      ]
      
      Fixes: 9a5ab8bf ("tools: bpftool: turn err() and info() macros into functions")
      Cc: Quentin Monnet <quentin.monnet@netronome.com>
      Signed-off-by: NKrzesimir Nowak <krzesimir@kinvolk.io>
      Acked-by: NAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      1884c066
  18. 28 4月, 2019 1 次提交
  19. 26 4月, 2019 2 次提交
  20. 17 4月, 2019 2 次提交
  21. 16 4月, 2019 2 次提交
  22. 10 4月, 2019 1 次提交
    • D
      bpf: bpftool support for dumping data/bss/rodata sections · 817998af
      Daniel Borkmann 提交于
      Add the ability to bpftool to handle BTF Var and DataSec kinds
      in order to dump them out of btf_dumper_type(). The value has a
      single object with the section name, which itself holds an array
      of variables it dumps. A single variable is an object by itself
      printed along with its name. From there further type information
      is dumped along with corresponding value information.
      
      Example output from .rodata:
      
        # ./bpftool m d i 150
        [{
                "value": {
                    ".rodata": [{
                            "load_static_data.bar": 18446744073709551615
                        },{
                            "num2": 24
                        },{
                            "num5": 43947
                        },{
                            "num6": 171
                        },{
                            "str0": [97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,0,0,0,0,0,0
                            ]
                        },{
                            "struct0": {
                                "a": 42,
                                "b": 4278120431,
                                "c": 1229782938247303441
                            }
                        },{
                            "struct2": {
                                "a": 0,
                                "b": 0,
                                "c": 0
                            }
                        }
                    ]
                }
            }
        ]
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      817998af
  23. 29 1月, 2019 2 次提交
  24. 23 1月, 2019 2 次提交
    • P
      bpftool: fix percpu maps updating · b0ca5ecb
      Paolo Abeni 提交于
      When updating a percpu map, bpftool currently copies the provided
      value only into the first per CPU copy of the specified value,
      all others instances are left zeroed.
      
      This change explicitly copies the user-provided bytes to all the
      per CPU instances, keeping the sub-command syntax unchanged.
      
      v2 -> v3:
       - drop unused argument, as per Quentin's suggestion
      v1 -> v2:
       - rename the helper as per Quentin's suggestion
      
      Fixes: 71bb428f ("tools: bpf: add bpftool")
      Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: NQuentin Monnet <quentin.monnet@netronome.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      b0ca5ecb
    • Q
      tools: bpftool: add probes for eBPF map types · f99e1663
      Quentin Monnet 提交于
      Add new probes for eBPF map types, to detect what are the ones available
      on the system. Try creating one map of each type, and see if the kernel
      complains.
      
      Sample output:
      
          # bpftool feature probe kernel
          ...
          Scanning eBPF map types...
          eBPF map_type hash is available
          eBPF map_type array is available
          eBPF map_type prog_array is available
          ...
      
          # bpftool --json --pretty feature probe kernel
          {
              ...
              "map_types": {
                  "have_hash_map_type": true,
                  "have_array_map_type": true,
                  "have_prog_array_map_type": true,
                  ...
              }
          }
      
      v5:
      - In libbpf.map, move global symbol to the new LIBBPF_0.0.2 section.
      
      v3:
      - Use a switch with all enum values for setting specific map parameters,
        so that gcc complains at compile time (-Wswitch-enum) if new map types
        were added to the kernel but libbpf was not updated.
      
      v2:
      - Move probes from bpftool to libbpf.
      - Remove C-style macros output from this patch.
      Signed-off-by: NQuentin Monnet <quentin.monnet@netronome.com>
      Reviewed-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Reviewed-by: NStanislav Fomichev <sdf@google.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      f99e1663
  25. 17 1月, 2019 4 次提交
    • S
      bpftool: add pop and dequeue commands · 74f312ef
      Stanislav Fomichev 提交于
      This is intended to be used with queues and stacks, it pops and prints
      the last element via bpf_map_lookup_and_delete_elem.
      
      Example:
      
      bpftool map create /sys/fs/bpf/q type queue value 4 entries 10 name q
      bpftool map push pinned /sys/fs/bpf/q value 0 1 2 3
      bpftool map pop pinned /sys/fs/bpf/q
      value: 00 01 02 03
      bpftool map pop pinned /sys/fs/bpf/q
      Error: empty map
      
      bpftool map create /sys/fs/bpf/s type stack value 4 entries 10 name s
      bpftool map enqueue pinned /sys/fs/bpf/s value 0 1 2 3
      bpftool map dequeue pinned /sys/fs/bpf/s
      value: 00 01 02 03
      bpftool map dequeue pinned /sys/fs/bpf/s
      Error: empty map
      Signed-off-by: NStanislav Fomichev <sdf@google.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      74f312ef
    • S
      bpftool: add push and enqueue commands · 549d4d3d
      Stanislav Fomichev 提交于
      This is intended to be used with queues and stacks and be more
      user-friendly than 'update' without the key.
      
      Example:
      bpftool map create /sys/fs/bpf/q type queue value 4 entries 10 name q
      bpftool map push pinned /sys/fs/bpf/q value 0 1 2 3
      bpftool map peek pinned /sys/fs/bpf/q
      value: 00 01 02 03
      
      bpftool map create /sys/fs/bpf/s type stack value 4 entries 10 name s
      bpftool map enqueue pinned /sys/fs/bpf/s value 0 1 2 3
      bpftool map peek pinned /sys/fs/bpf/s
      value: 00 01 02 03
      Signed-off-by: NStanislav Fomichev <sdf@google.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      549d4d3d
    • S
      bpftool: add peek command · 66cf6e0b
      Stanislav Fomichev 提交于
      This is intended to be used with queues and stacks and be more
      user-friendly than 'lookup' without key/value.
      
      Example:
      bpftool map create /sys/fs/bpf/q type queue value 4 entries 10 name q
      bpftool map update pinned /sys/fs/bpf/q value 0 1 2 3
      bpftool map peek pinned /sys/fs/bpf/q
      value: 00 01 02 03
      Signed-off-by: NStanislav Fomichev <sdf@google.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      66cf6e0b
    • S
      bpftool: don't print empty key/value for maps · 04a5d323
      Stanislav Fomichev 提交于
      When doing dump or lookup, don't print key if key_size == 0 or value if
      value_size == 0. The initial usecase is queue and stack, where we have
      only values.
      
      This is for regular output only, json still has all the fields.
      
      Before:
      bpftool map create /sys/fs/bpf/q type queue value 4 entries 10 name q
      bpftool map update pinned /sys/fs/bpf/q value 0 1 2 3
      bpftool map lookup pinned /sys/fs/bpf/q
      key:   value: 00 01 02 03
      
      After:
      bpftool map create /sys/fs/bpf/q type queue value 4 entries 10 name q
      bpftool map update pinned /sys/fs/bpf/q value 0 1 2 3
      bpftool map lookup pinned /sys/fs/bpf/q
      value: 00 01 02 03
      Signed-off-by: NStanislav Fomichev <sdf@google.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      04a5d323