diff options
author | Toke Høiland-Jørgensen <toke@redhat.com> | 2020-03-25 18:23:26 +0100 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-03-28 14:24:41 -0700 |
commit | 92234c8f15c8d96ad7e52afdc5994cba6be68eb9 (patch) | |
tree | 7c90ed94c5f54397d15f2c475732b416deda33a5 /net/unix/scm.c | |
parent | e9ff9d52540a53ce8c9eff5bf8b66467fe81eb2b (diff) |
xdp: Support specifying expected existing program when attaching XDP
While it is currently possible for userspace to specify that an existing
XDP program should not be replaced when attaching to an interface, there is
no mechanism to safely replace a specific XDP program with another.
This patch adds a new netlink attribute, IFLA_XDP_EXPECTED_FD, which can be
set along with IFLA_XDP_FD. If set, the kernel will check that the program
currently loaded on the interface matches the expected one, and fail the
operation if it does not. This corresponds to a 'cmpxchg' memory operation.
Setting the new attribute with a negative value means that no program is
expected to be attached, which corresponds to setting the UPDATE_IF_NOEXIST
flag.
A new companion flag, XDP_FLAGS_REPLACE, is also added to explicitly
request checking of the EXPECTED_FD attribute. This is needed for userspace
to discover whether the kernel supports the new attribute.
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/bpf/158515700640.92963.3551295145441017022.stgit@toke.dk
Diffstat (limited to 'net/unix/scm.c')
0 files changed, 0 insertions, 0 deletions