On Mon, Sep 28, 2020 at 10:08:05AM +0100, Lorenz Bauer wrote: [ ... ] > SEC("iter/sockmap") > -int count_elems(struct bpf_iter__sockmap *ctx) > +int copy(struct bpf_iter__sockmap *ctx) > { > struct sock *sk = ctx->sk; > __u32 tmp, *key = ctx->key; > int ret; > > - if (key) > - elems++; > + if (!key) > + return 0; > > - if (sk) > + elems++; > + > + /* We need a temporary buffer on the stack, since the verifier doesn't > + * let us use the pointer from the context as an argument to the helper. Is it something that can be improved later? others LGTM.