On Thu, 11 Apr 2019 17:27:00 +0900, Benjamin Poirier wrote:
> avoids outputting a series of
>       value:
>       No space left on device
> 
> The value itself is not wrong but bpf_fd_reuseport_array_lookup_elem() can
> only return it if the map was created with value_size = 8. There's nothing
> bpftool can do about it. Instead of repeating this error for every key in
> the map, print the error once, print an explanatory message and exit.
> 
> Signed-off-by: Benjamin Poirier <bpoir...@suse.com>

> @@ -787,7 +787,16 @@ static int do_dump(int argc, char **argv)
>                               err = 0;
>                       break;
>               }
> -             num_elems += dump_map_elem(fd, key, value, &info, btf, btf_wtr);
> +             err = dump_map_elem(fd, key, value, &info, btf, btf_wtr);
> +             /* bpf_fd_reuseport_array_lookup_elem() can only return a
> +              * value if the map's value_size == 8
> +              */
> +             if (info.type == BPF_MAP_TYPE_REUSEPORT_SOCKARRAY &&
> +                 info.value_size != 8 && err == -ENOSPC) {
> +                     p_err("cannot dump REUSEPORT_SOCKARRAY map with 
> value_size != 8");
> +                     goto exit_free;

Hmm... could it still be useful to walk the map to see the keys, even
if the kernel can't return meaningful values?

> +             }
> +             num_elems += err;
>               prev_key = key;
>       }
>  

Reply via email to