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, Jan 22, 2020 at 05:24 PM CET, Lorenz Bauer wrote:
> 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?

Makes sense. Queuing it for next iteration if more things pile up.

To give the rest of reviewers some context - Lorenz started looking at
adding bare-bones support for UDP to sockmap. Bare-bones meaning that
UDP sockets could be inserted/deleted into/from sockmap, but not spliced
with sockmap.

Being consistent about how we check if a socket can be used for splicing
will make extending it for UDP easier.

Thanks,
-jkbs



[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