mbox series

[bpf-next,v3,0/2] Enable bpf_setsockopt() on ktls enabled sockets.

Message ID 20230125201608.908230-1-kuifeng@meta.com (mailing list archive)
Headers show
Series Enable bpf_setsockopt() on ktls enabled sockets. | expand

Message

Kui-Feng Lee Jan. 25, 2023, 8:16 p.m. UTC
This patchset implements a change to bpf_setsockopt() which allows
ktls enabled sockets to be used with the SOL_TCP level. This is
necessary as when ktls is enabled, it changes the function pointer of
setsockopt of the socket, which bpf_setsockopt() checks in order to
make sure that the socket is a TCP socket. Checking sk_protocol
instead of the function pointer will ensure that bpf_setsockopt() with
the SOL_TCP level still works on sockets with ktls enabled.

The major differences form v2 are:
 - Add a read() call to make sure that the FIN has arrived.
 - Remove the dependency on other test's header.

The major differences from v1 are:
 - Test with a IPv6 connect as well.
 - Use ASSERT_OK()

v2: https://lore.kernel.org/bpf/20230124181220.2871611-1-kuifeng@meta.com/
v1: https://lore.kernel.org/bpf/20230121025716.3039933-1-kuifeng@meta.com/

Kui-Feng Lee (2):
  bpf: Check the protocol of a sock to agree the calls to
    bpf_setsockopt().
  selftests/bpf: Calls bpf_setsockopt() on a ktls enabled socket.

 net/core/filter.c                             |  2 +-
 .../selftests/bpf/prog_tests/setget_sockopt.c | 73 +++++++++++++++++++
 .../selftests/bpf/progs/setget_sockopt.c      |  8 ++
 3 files changed, 82 insertions(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org Jan. 25, 2023, 11:20 p.m. UTC | #1
Hello:

This series was applied to bpf/bpf-next.git (master)
by Martin KaFai Lau <martin.lau@kernel.org>:

On Wed, 25 Jan 2023 12:16:06 -0800 you wrote:
> This patchset implements a change to bpf_setsockopt() which allows
> ktls enabled sockets to be used with the SOL_TCP level. This is
> necessary as when ktls is enabled, it changes the function pointer of
> setsockopt of the socket, which bpf_setsockopt() checks in order to
> make sure that the socket is a TCP socket. Checking sk_protocol
> instead of the function pointer will ensure that bpf_setsockopt() with
> the SOL_TCP level still works on sockets with ktls enabled.
> 
> [...]

Here is the summary with links:
  - [bpf-next,v3,1/2] bpf: Check the protocol of a sock to agree the calls to bpf_setsockopt().
    https://git.kernel.org/bpf/bpf-next/c/2ab42c7b871f
  - [bpf-next,v3,2/2] selftests/bpf: Calls bpf_setsockopt() on a ktls enabled socket.
    https://git.kernel.org/bpf/bpf-next/c/d1246f936023

You are awesome, thank you!