On Wed, Nov 03, 2021 at 09:47 PM CET, John Fastabend wrote: > In order to fix an issue with sockets in TCP sockmap redirect cases > we plan to allow CLOSE state sockets to exist in the sockmap. However, > the check in bpf_sk_lookup_assign currently only invalidates sockets > in the TCP_ESTABLISHED case relying on the checks on sockmap insert > to ensure we never SOCK_CLOSE state sockets in the map. > > To prepare for this change we flip the logic in bpf_sk_lookup_assign() > to explicitly test for the accepted cases. Namely, a tcp socket in > TCP_LISTEN or a udp socket in TCP_CLOSE state. This also makes the > code more resilent to future changes. > > Suggested-by: Jakub Sitnicki <jakub@xxxxxxxxxxxxxx> > Signed-off-by: John Fastabend <john.fastabend@xxxxxxxxx> > --- Thanks, John, for patching up the helper. I will follow up with a test to cover unbound sockets. Reviewed-by: Jakub Sitnicki <jakub@xxxxxxxxxxxxxx>