bpf: Add BPF_(PROG|MAP)_GET_NEXT_ID command
authorMartin KaFai Lau <kafai@fb.com>
Mon, 5 Jun 2017 19:15:48 +0000 (12:15 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 6 Jun 2017 19:41:23 +0000 (15:41 -0400)
commit34ad5580f8f9c86cb273ebea25c149613cd1667e
tree47618c705d66fc9f0b977716cd7c1389e1552bdc
parentf3f1c054c288bb6e503005e6d73611151ed20e91
bpf: Add BPF_(PROG|MAP)_GET_NEXT_ID command

This patch adds BPF_PROG_GET_NEXT_ID and BPF_MAP_GET_NEXT_ID
to allow userspace to iterate all bpf_prog IDs and bpf_map IDs.

The API is trying to be consistent with the existing
BPF_MAP_GET_NEXT_KEY.

It is currently limited to CAP_SYS_ADMIN which we can
consider to lift it in followup patches.

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Alexei Starovoitov <ast@fb.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/uapi/linux/bpf.h
kernel/bpf/syscall.c