mbox series

[bpf-next,v3,0/4,bpf-next,v2,0/4] Sockmap copying

Message ID 20200929093039.73872-1-lmb@cloudflare.com (mailing list archive)
Headers show
Series Sockmap copying | expand

Message

Lorenz Bauer Sept. 29, 2020, 9:30 a.m. UTC
Changes in v3:
- Initialize duration to 0 in selftests (Martin)

Changes in v2:
- Check sk_fullsock in map_update_elem (Martin)

Enable calling map_update_elem on sockmaps from bpf_iter context. This
in turn allows us to copy a sockmap by iterating its elements.

The change itself is tiny, all thanks to the ground work from Martin,
whose series [1] this patch is based on. I updated the tests to do some
copying, and also included two cleanups.

1: https://lore.kernel.org/bpf/20200925000337.3853598-1-kafai@fb.com/

Lorenz Bauer (4):
  bpf: sockmap: enable map_update_elem from bpf_iter
  selftests: bpf: Add helper to compare socket cookies
  selftests: bpf: remove shared header from sockmap iter test
  selftest: bpf: Test copying a sockmap and sockhash

 kernel/bpf/verifier.c                         |   2 +-
 net/core/sock_map.c                           |   3 +
 .../selftests/bpf/prog_tests/sockmap_basic.c  | 100 +++++++++++-------
 .../selftests/bpf/progs/bpf_iter_sockmap.c    |  32 ++++--
 .../selftests/bpf/progs/bpf_iter_sockmap.h    |   3 -
 5 files changed, 90 insertions(+), 50 deletions(-)
 delete mode 100644 tools/testing/selftests/bpf/progs/bpf_iter_sockmap.h

Comments

Alexei Starovoitov Sept. 29, 2020, 3:53 p.m. UTC | #1
On Tue, Sep 29, 2020 at 2:31 AM Lorenz Bauer <lmb@cloudflare.com> wrote:
>
> Changes in v3:
> - Initialize duration to 0 in selftests (Martin)

Clearly you didn't rebase.