Re: [PATCH bpf-next v2 1/9] bpf: sockmap: only check ULP for TCP sockets

From: Lorenz Bauer
Date: Wed Mar 04 2020 - 03:39:36 EST


On Tue, 3 Mar 2020 at 18:35, John Fastabend <john.fastabend@xxxxxxxxx> wrote:
>
> > diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h
> > index 112765bd146d..54a9a3e36b29 100644
> > --- a/include/linux/skmsg.h
> > +++ b/include/linux/skmsg.h
> > @@ -360,7 +360,13 @@ static inline void sk_psock_restore_proto(struct sock *sk,
> > struct sk_psock *psock)
> > {
> > sk->sk_prot->unhash = psock->saved_unhash;
> > - tcp_update_ulp(sk, psock->sk_proto, psock->saved_write_space);
> > + if (inet_sk(sk)->is_icsk) {
>
> use sock_map_sk_has_ulp() here as well and then drop the !icsk->icsk_ulp_ops
> case in tcp_update_ulp()?

This requires moving sock_map_sk_has_ulp to the header, which seemed like the
incorrect place. How about adding bool inet_csk_has_ulp(sk) to
inet_connection_sock.h?

--
Lorenz Bauer | Systems Engineer
6th Floor, County Hall/The Riverside Building, SE1 7PB, UK

www.cloudflare.com