diff options
author | Lawrence Brakmo <brakmo@fb.com> | 2018-01-26 03:14:07 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2018-01-26 03:41:13 +0300 |
commit | 34d367c59233464dbd1f07445c4665099a7128ec (patch) | |
tree | 3d661ded06f00744bc5eabbf0906177649a77fc3 /include/net/tcp.h | |
parent | a33de3973488680def6a900e74ec67ba2bef226c (diff) | |
download | linux-34d367c59233464dbd1f07445c4665099a7128ec.tar.xz |
bpf: Make SOCK_OPS_GET_TCP struct independent
Changed SOCK_OPS_GET_TCP to SOCK_OPS_GET_FIELD and added 2
arguments so now it can also work with struct sock fields.
The first argument is the name of the field in the bpf_sock_ops
struct, the 2nd argument is the name of the field in the OBJ struct.
Previous: SOCK_OPS_GET_TCP(FIELD_NAME)
New: SOCK_OPS_GET_FIELD(BPF_FIELD, OBJ_FIELD, OBJ)
Where OBJ is either "struct tcp_sock" or "struct sock" (without
quotation). BPF_FIELD is the name of the field in the bpf_sock_ops
struct and OBJ_FIELD is the name of the field in the OBJ struct.
Although the field names are currently the same, the kernel struct names
could change in the future and this change makes it easier to support
that.
Note that adding access to tcp_sock fields in sock_ops programs does
not preclude the tcp_sock fields from being removed as long as we are
willing to do one of the following:
1) Return a fixed value (e.x. 0 or 0xffffffff), or
2) Make the verifier fail if that field is accessed (i.e. program
fails to load) so the user will know that field is no longer
supported.
Signed-off-by: Lawrence Brakmo <brakmo@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include/net/tcp.h')
0 files changed, 0 insertions, 0 deletions