On Mon, Sep 28, 2020 at 10:08:03AM +0100, Lorenz Bauer wrote: > We compare socket cookies to ensure that insertion into a sockmap worked. > Pull this out into a helper function for use in other tests. > > Signed-off-by: Lorenz Bauer <lmb@xxxxxxxxxxxxxx> > --- > .../selftests/bpf/prog_tests/sockmap_basic.c | 50 +++++++++++++------ > 1 file changed, 36 insertions(+), 14 deletions(-) > > diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c b/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c > index 4b7a527e7e82..67d3301bdf81 100644 > --- a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c > +++ b/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c > @@ -50,6 +50,37 @@ static int connected_socket_v4(void) > return -1; > } > > +static void compare_cookies(struct bpf_map *src, struct bpf_map *dst) > +{ > + __u32 i, max_entries = bpf_map__max_entries(src); > + int err, duration, src_fd, dst_fd; This should have a compiler warning. "duration" is not initialized.