Subject: Re: [PATCH iproute2 -master] tc: {m,f}_ebpf: add option for dumping verifier log

From: Alexei Starovoitov <[email-masked]>
Date: Tue, 28 Apr 2015 13:37:48 -0700

On 4/28/15 4:37 AM, Daniel Borkmann wrote:
> Currently, only on error we get a log dump, but I found it useful when
> working with eBPF to have an option to also dump the log on success.
> Also spotted a typo in a header comment, which is fixed here as well.
>
> Signed-off-by: Daniel Borkmann <[email-masked]>
> Cc: Alexei Starovoitov <[email-masked]>
...
> @@ -284,8 +287,11 @@ static int bpf_prog_attach(enum bpf_prog_type type, const struct bpf_insn *insns
>   {
>   	int prog_fd = bpf_prog_load(type, insns, size, license);
>
> -	if (prog_fd < 0)
> -		bpf_dump_error("BPF program rejected: %s\n", strerror(errno));
> +	if (prog_fd < 0 || bpf_verbose) {
> +		bpf_dump_error("%s: %s\n", prog_fd < 0 ?
> +			       "BPF program rejected" :
> +			       "BPF program verification", strerror(errno));
> +	}

I have very similar hack locally that I stash/unstash periodically for
debugging. Good thing to have it in generic form.

Acked-by: Alexei Starovoitov <[email-masked]>