]> git.baikalelectronics.ru Git - kernel.git/commit
net: introduce SO_BPF_EXTENSIONS
authorMichal Sekletar <msekleta@redhat.com>
Fri, 17 Jan 2014 16:09:45 +0000 (17:09 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 19 Jan 2014 03:08:58 +0000 (19:08 -0800)
commita15b5eb57fdc34fd662b622dc4874e553fad1164
treec058c0f3060402a8778ed077f7dc092e62fc0958
parent662ee35cac80d92ef67da8f91861cd30ee54f3dc
net: introduce SO_BPF_EXTENSIONS

For user space packet capturing libraries such as libpcap, there's
currently only one way to check which BPF extensions are supported
by the kernel, that is, commit 44ab285e911e ("net: filter: return
-EINVAL if BPF_S_ANC* operation is not supported"). For querying all
extensions at once this might be rather inconvenient.

Therefore, this patch introduces a new option which can be used as
an argument for getsockopt(), and allows one to obtain information
about which BPF extensions are supported by the current kernel.

As David Miller suggests, we do not need to define any bits right
now and status quo can just return 0 in order to state that this
versions supports SKF_AD_PROTOCOL up to SKF_AD_PAY_OFFSET. Later
additions to BPF extensions need to add their bits to the
bpf_tell_extensions() function, as documented in the comment.

Signed-off-by: Michal Sekletar <msekleta@redhat.com>
Cc: David Miller <davem@davemloft.net>
Reviewed-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 files changed:
arch/alpha/include/uapi/asm/socket.h
arch/avr32/include/uapi/asm/socket.h
arch/cris/include/uapi/asm/socket.h
arch/frv/include/uapi/asm/socket.h
arch/ia64/include/uapi/asm/socket.h
arch/m32r/include/uapi/asm/socket.h
arch/mips/include/uapi/asm/socket.h
arch/mn10300/include/uapi/asm/socket.h
arch/parisc/include/uapi/asm/socket.h
arch/powerpc/include/uapi/asm/socket.h
arch/s390/include/uapi/asm/socket.h
arch/sparc/include/uapi/asm/socket.h
arch/xtensa/include/uapi/asm/socket.h
include/linux/filter.h
include/uapi/asm-generic/socket.h
net/core/sock.c