1. 24 Apr, 2024 18 commits
  2. 22 Apr, 2024 2 commits
  3. 21 Apr, 2024 2 commits
  4. 20 Apr, 2024 7 commits
  5. 18 Apr, 2024 1 commit
  6. 17 Apr, 2024 2 commits
    • Quentin Deslandes's avatar
      libbpf: Fix dump of subsequent char arrays · e739e01d
      Quentin Deslandes authored
      When dumping a character array, libbpf will watch for a '\0' and set
      is_array_terminated=true if found. This prevents libbpf from printing
      the remaining characters of the array, treating it as a nul-terminated
      string.
      
      However, once this flag is set, it's never reset, leading to subsequent
      characters array not being printed properly:
      
      .str_multi = (__u8[2][16])[
          [
              'H',
              'e',
              'l',
          ],
      ],
      
      This patch saves the is_array_terminated flag and restores its
      default (false) value before looping over the elements of an array,
      then restores it afterward. This way, libbpf's behavior is unchanged
      when dumping the characters of an array, but subsequent arrays are
      printed properly:
      
      .str_multi = (__u8[2][16])[
          [
              'H',
              'e',
              'l',
          ],
          [
              'l',
              'o',
          ],
      ],
      Signed-off-by: default avatarQuentin Deslandes <qde@naccy.de>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20240413211258.134421-3-qde@naccy.de
      e739e01d
    • Quentin Deslandes's avatar
      libbpf: Fix misaligned array closing bracket · 9213e529
      Quentin Deslandes authored
      In btf_dump_array_data(), libbpf will call btf_dump_dump_type_data() for
      each element. For an array of characters, each element will be
      processed the following way:
      
      - btf_dump_dump_type_data() is called to print the character
      - btf_dump_data_pfx() prefixes the current line with the proper number
        of indentations
      - btf_dump_int_data() is called to print the character
      - After the last character is printed, btf_dump_dump_type_data() calls
        btf_dump_data_pfx() before writing the closing bracket
      
      However, for an array containing characters, btf_dump_int_data() won't
      print any '\0' and subsequent characters. This leads to situations where
      the line prefix is written, no character is added, then the prefix is
      written again before adding the closing bracket:
      
      (struct sk_metadata){
          .str_array = (__u8[14])[
              'H',
              'e',
              'l',
              'l',
              'o',
                      ],
      
      This change solves this issue by printing the '\0' character, which
      has two benefits:
      
      - The bracket closing the array is properly aligned
      - It's clear from a user point of view that libbpf uses '\0' as a
        terminator for arrays of characters.
      Signed-off-by: default avatarQuentin Deslandes <qde@naccy.de>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20240413211258.134421-2-qde@naccy.de
      9213e529
  7. 16 Apr, 2024 5 commits
  8. 12 Apr, 2024 2 commits
  9. 11 Apr, 2024 1 commit
    • Martin KaFai Lau's avatar
      Merge branch 'export send_recv_data' · c53e853c
      Martin KaFai Lau authored
      Geliang Tang says:
      
      ====================
      v5:
       - address Martin's comments for v4 (thanks).
       - update patch 2, use 'return err' instead of 'return -1/0'.
       - drop patch 3 in v4.
      
      v4:
       - fix a bug in v3, it should be 'if (err)', not 'if (!err)'.
       - move "selftests/bpf: Use log_err in network_helpers" out of this
         series.
      
      v3:
       - add two more patches.
       - use log_err instead of ASSERT in v3.
       - let send_recv_data return int as Martin suggested.
      
      v2:
      
      Address Martin's comments for v1 (thanks.)
       - drop patch 1, "export send_byte helper".
       - drop "WRITE_ONCE(arg.stop, 0)".
       - rebased.
      
      send_recv_data will be re-used in MPTCP bpf tests, but not included
      in this set because it depends on other patches that have not been
      in the bpf-next yet. It will be sent as another set soon.
      ====================
      Signed-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
      c53e853c