Search code examples
linuxlinux-kernelbpfebpf

How can I work out the meaning of the return codes for BPF helper functions?


I am writing a BPF_PROG_TYPE_SOCKET_OPS program and I am seeing the following in /sys/kernel/debug/tracing/trace_pipe:

<...>-12586 [001] ....  6972.409111: 0: update err: -95

when I load it due to the following snippet:

ret = bpf_sock_map_update(ops, &sock_ops, &idx, BPF_ANY);
if (ret < 0) {
    bpf_debug("update err: %d\n", ret);
}

How can I work out what -95 means? When I look in https://elixir.bootlin.com/linux/latest/source/arch/alpha/include/uapi/asm/errno.h I see:

#define ENOCSI      95  /* No CSI structure available */

Is this the correct way to find the meaning of the error? And what is the meaning of the description if so?


Solution

  • The error was EOPNOTSUPP from here. This was caused by the socket not being 'full' when trying to add the socket (i.e. the TCP connection must be established).