Helper function bpf_sock_map_update
Add an entry to, or update a map
referencing sockets.
Definition
Copyright (c) 2015 The Libbpf Authors. All rights reserved.
Returns 0 on success, or a negative error in case of failure.
static long (* const bpf_sock_map_update)(struct bpf_sock_ops *skops, void *map, void *key, __u64 flags) = (void *) 53;
Usage
The skops
is used as a new value for the entry associated to key
. flags
is one of:
BPF_NOEXIST
- The entry forkey
must not exist in the map.BPF_EXIST
- The entry forkey
must already exist in the map.BPF_ANY
- No condition on the existence of the entry forkey
.
If the map
has eBPF programs (parser and verdict), those will be inherited by the socket being added. If the socket is already attached to eBPF programs, this results in an error.
Program types
This helper call can be used in the following program types:
Map types
This helper call can be used with the following map types:
Example
Docs could be improved
This part of the docs is incomplete, contributions are very welcome