Re: [PATCH bpf-next v3 06/12] bpf, sockmap: Don't set up sockmap progs for listening sockets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 22 Jan 2020 at 13:06, Jakub Sitnicki <jakub@xxxxxxxxxxxxxx> wrote:
> @@ -352,7 +376,15 @@ static int sock_map_update_common(struct bpf_map *map, u32 idx,
>         if (!link)
>                 return -ENOMEM;
>
> -       ret = sock_map_link(map, &stab->progs, sk);
> +       /* Only established or almost established sockets leaving
> +        * SYN_RECV state need to hold refs to parser/verdict progs
> +        * and have their sk_data_ready and sk_write_space callbacks
> +        * overridden.
> +        */
> +       if (sk->sk_state == TCP_LISTEN)
> +               ret = sock_map_link_no_progs(map, sk);
> +       else
> +               ret = sock_map_link(map, &stab->progs, sk);

Could you use sock_map_redirect_okay from the previous patch here
instead of checking for TCP_LISTEN?

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

www.cloudflare.com



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux