bpf: support flow dissector in libbpf and bpftool
authorPetar Penkov <ppenkov@google.com>
Fri, 14 Sep 2018 14:46:20 +0000 (07:46 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 14 Sep 2018 19:04:33 +0000 (12:04 -0700)
This patch extends libbpf and bpftool to work with programs of type
BPF_PROG_TYPE_FLOW_DISSECTOR.

Signed-off-by: Petar Penkov <ppenkov@google.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/bpf/bpftool/prog.c
tools/lib/bpf/libbpf.c

index dce960d..b1cd3bc 100644 (file)
@@ -74,6 +74,7 @@ static const char * const prog_type_name[] = {
        [BPF_PROG_TYPE_RAW_TRACEPOINT]  = "raw_tracepoint",
        [BPF_PROG_TYPE_CGROUP_SOCK_ADDR] = "cgroup_sock_addr",
        [BPF_PROG_TYPE_LIRC_MODE2]      = "lirc_mode2",
+       [BPF_PROG_TYPE_FLOW_DISSECTOR]  = "flow_dissector",
 };
 
 static void print_boot_time(__u64 nsecs, char *buf, unsigned int size)
index 8476da7..9ca8e0e 100644 (file)
@@ -1502,6 +1502,7 @@ static bool bpf_prog_type__needs_kver(enum bpf_prog_type type)
        case BPF_PROG_TYPE_CGROUP_SOCK_ADDR:
        case BPF_PROG_TYPE_LIRC_MODE2:
        case BPF_PROG_TYPE_SK_REUSEPORT:
+       case BPF_PROG_TYPE_FLOW_DISSECTOR:
                return false;
        case BPF_PROG_TYPE_UNSPEC:
        case BPF_PROG_TYPE_KPROBE:
@@ -2121,6 +2122,7 @@ static const struct {
        BPF_PROG_SEC("sk_skb",          BPF_PROG_TYPE_SK_SKB),
        BPF_PROG_SEC("sk_msg",          BPF_PROG_TYPE_SK_MSG),
        BPF_PROG_SEC("lirc_mode2",      BPF_PROG_TYPE_LIRC_MODE2),
+       BPF_PROG_SEC("flow_dissector",  BPF_PROG_TYPE_FLOW_DISSECTOR),
        BPF_SA_PROG_SEC("cgroup/bind4", BPF_CGROUP_INET4_BIND),
        BPF_SA_PROG_SEC("cgroup/bind6", BPF_CGROUP_INET6_BIND),
        BPF_SA_PROG_SEC("cgroup/connect4", BPF_CGROUP_INET4_CONNECT),