Re: [RFC PATCH net-next v2 2/2] selftests: net: add XDP socket tests for virtio-net

2025-06-03 Thread Bui Quang Minh
:04PM +0700, Bui Quang Minh wrote: This adds a test to test the virtio-net rx when there is a XDP socket bound to it. There are tests for both copy mode and zerocopy mode, both cases when XDP program returns XDP_PASS and XDP_REDIRECT to a XDP socket. Signed-off-by: Bui Quang Minh Hi Bui, have you

Re: [RFC PATCH net-next v2 2/2] selftests: net: add XDP socket tests for virtio-net

2025-06-02 Thread Maciej Fijalkowski
PM +0700, Bui Quang Minh wrote: > > > > > This adds a test to test the virtio-net rx when there is a XDP socket > > > > > bound to it. There are tests for both copy mode and zerocopy mode, > > > > > both > > > > > cases when XDP program

Re: [RFC PATCH net-next v2 2/2] selftests: net: add XDP socket tests for virtio-net

2025-05-31 Thread Bui Quang Minh
On 5/30/25 18:45, Maciej Fijalkowski wrote: On Thu, May 29, 2025 at 09:29:14PM +0700, Bui Quang Minh wrote: On 5/29/25 18:18, Maciej Fijalkowski wrote: On Tue, May 27, 2025 at 11:19:04PM +0700, Bui Quang Minh wrote: This adds a test to test the virtio-net rx when there is a XDP socket bound

Re: [RFC PATCH net-next v2 2/2] selftests: net: add XDP socket tests for virtio-net

2025-05-30 Thread Maciej Fijalkowski
On Thu, May 29, 2025 at 09:29:14PM +0700, Bui Quang Minh wrote: > On 5/29/25 18:18, Maciej Fijalkowski wrote: > > On Tue, May 27, 2025 at 11:19:04PM +0700, Bui Quang Minh wrote: > > > This adds a test to test the virtio-net rx when there is a XDP socket > > > bound to i

Re: [RFC PATCH net-next v2 2/2] selftests: net: add XDP socket tests for virtio-net

2025-05-29 Thread Bui Quang Minh
On 5/29/25 18:18, Maciej Fijalkowski wrote: On Tue, May 27, 2025 at 11:19:04PM +0700, Bui Quang Minh wrote: This adds a test to test the virtio-net rx when there is a XDP socket bound to it. There are tests for both copy mode and zerocopy mode, both cases when XDP program returns XDP_PASS and

Re: [RFC PATCH net-next v2 2/2] selftests: net: add XDP socket tests for virtio-net

2025-05-29 Thread Maciej Fijalkowski
On Tue, May 27, 2025 at 11:19:04PM +0700, Bui Quang Minh wrote: > This adds a test to test the virtio-net rx when there is a XDP socket > bound to it. There are tests for both copy mode and zerocopy mode, both > cases when XDP program returns XDP_PASS and XDP_REDIRECT to a XDP socket. &g

Re: [RFC PATCH net-next v2 2/2] selftests: net: add XDP socket tests for virtio-net

2025-05-28 Thread Bui Quang Minh
On 5/29/25 00:04, ALOK TIWARI wrote: On 27-05-2025 21:49, Bui Quang Minh wrote: +def main(): +    with NetDrvEpEnv(__file__, nsim_test=False) as cfg: +    cfg.bin_local = path.abspath(path.dirname(__file__) +    + "/../../../drivers/net/hw/xsk_receive") +    cfg

Re: [RFC PATCH net-next v2 2/2] selftests: net: add XDP socket tests for virtio-net

2025-05-28 Thread ALOK TIWARI
On 27-05-2025 21:49, Bui Quang Minh wrote: +def main(): +with NetDrvEpEnv(__file__, nsim_test=False) as cfg: +cfg.bin_local = path.abspath(path.dirname(__file__) ++ "/../../../drivers/net/hw/xsk_receive") +cfg.bin_remote = cfg.remote.deploy(cfg.b

[RFC PATCH net-next v2 2/2] selftests: net: add XDP socket tests for virtio-net

2025-05-27 Thread Bui Quang Minh
This adds a test to test the virtio-net rx when there is a XDP socket bound to it. There are tests for both copy mode and zerocopy mode, both cases when XDP program returns XDP_PASS and XDP_REDIRECT to a XDP socket. Signed-off-by: Bui Quang Minh --- .../selftests/drivers/net/hw/.gitignore

[PATCH bpf-next v3 1/8] selftests/bpf: Support af_unix SOCK_DGRAM socket pair creation

2025-05-14 Thread Michal Luczaj
Handle af_unix in init_addr_loopback(). For pair creation, bind() the peer socket to make SOCK_DGRAM connect() happy. Reviewed-by: Jakub Sitnicki Acked-by: John Fastabend Signed-off-by: Michal Luczaj --- .../selftests/bpf/prog_tests/socket_helpers.h | 29 ++ 1 file

Re: [PATCH net] vsock: avoid timeout during connect() if the socket is closing

2025-04-02 Thread patchwork-bot+netdevbpf
However, the > other peer can be fast enough to accept the connection and close it > immediately, thus moving the state to TCP_CLOSING. > > [...] Here is the summary with links: - [net] vsock: avoid timeout during connect() if the socket is closing https://git.kernel.org/netdev

Re: [PATCH net] vsock: avoid timeout during connect() if the socket is closing

2025-04-01 Thread Luigi Leonardi
close it immediately, thus moving the state to TCP_CLOSING. When this happens, the peer in the vsock_connect() is properly woken up, but since the state is not TCP_ESTABLISHED, it goes back to sleep until the timeout expires, returning -ETIMEDOUT. If the socket state is TCP_CLOSING, waiting for the

Re: [PATCH net] vsock: avoid timeout during connect() if the socket is closing

2025-04-01 Thread Paolo Abeni
on and close it > immediately, thus moving the state to TCP_CLOSING. > > When this happens, the peer in the vsock_connect() is properly woken up, > but since the state is not TCP_ESTABLISHED, it goes back to sleep > until the timeout expires, returning -ETIMEDOUT. > > If the socket s

[PATCH net] vsock: avoid timeout during connect() if the socket is closing

2025-03-28 Thread Stefano Garzarella
happens, the peer in the vsock_connect() is properly woken up, but since the state is not TCP_ESTABLISHED, it goes back to sleep until the timeout expires, returning -ETIMEDOUT. If the socket state is TCP_CLOSING, waiting for the timeout is pointless. vsock_connect() can return immediately without

Re: [PATCH bpf-next v1 2/3] selftests/bpf: Add socketpair to create_pair to support unix socket

2025-02-28 Thread Jiayuan Chen
On Thu, Feb 27, 2025 at 02:21:41PM -0800, John Fastabend wrote: > On 2025-02-27 11:52:04, Cong Wang wrote: > > On Wed, Feb 26, 2025 at 09:22:41PM +0800, Jiayuan Chen wrote: > > > Current wrapper function create_pair() is used to create a pair of > > > connected links and returns two fds, but it doe

[PATCH bpf-next v2 2/3] selftests/bpf: Add socketpair to create_pair to support unix socket

2025-02-27 Thread Jiayuan Chen
Current wrapper function create_pair() is used to create a pair of connected links and returns two fds, but it does not support unix sockets. Here we introduce socketpair() into create_pair(), which supports creating a pair of unix sockets, since the semantics of the two are the same. Signed-off-

Re: [PATCH bpf-next v1 2/3] selftests/bpf: Add socketpair to create_pair to support unix socket

2025-02-27 Thread Jiayuan Chen
On Thu, Feb 27, 2025 at 11:52:04AM -0800, Cong Wang wrote: > On Wed, Feb 26, 2025 at 09:22:41PM +0800, Jiayuan Chen wrote: > > Current wrapper function create_pair() is used to create a pair of > > connected links and returns two fds, but it does not support unix sockets. > > > > Here we introduce

Re: [PATCH bpf-next v1 2/3] selftests/bpf: Add socketpair to create_pair to support unix socket

2025-02-27 Thread John Fastabend
On 2025-02-27 11:52:04, Cong Wang wrote: > On Wed, Feb 26, 2025 at 09:22:41PM +0800, Jiayuan Chen wrote: > > Current wrapper function create_pair() is used to create a pair of > > connected links and returns two fds, but it does not support unix sockets. > > > > Here we introduce socketpair() into

Re: [PATCH bpf-next v1 2/3] selftests/bpf: Add socketpair to create_pair to support unix socket

2025-02-27 Thread Cong Wang
On Wed, Feb 26, 2025 at 09:22:41PM +0800, Jiayuan Chen wrote: > Current wrapper function create_pair() is used to create a pair of > connected links and returns two fds, but it does not support unix sockets. > > Here we introduce socketpair() into create_pair(), which supports creating > a pair of

[PATCH bpf-next v1 2/3] selftests/bpf: Add socketpair to create_pair to support unix socket

2025-02-26 Thread Jiayuan Chen
Current wrapper function create_pair() is used to create a pair of connected links and returns two fds, but it does not support unix sockets. Here we introduce socketpair() into create_pair(), which supports creating a pair of unix sockets, since the semantics of the two are the same. Signed-off-

Re: [PATCH net 2/4] vsock/bpf: Warn on socket without transport

2025-02-18 Thread Stefano Garzarella
!vsk->transport)) { copied = -ENODEV; goto out; } I'm not a sockmap expert, so I don't understand why here print an error. Since there was already a check, I expected it to be a case that can happen, but instead calling `rcvmsg()` on a socket n

Re: [PATCH net 2/4] vsock/bpf: Warn on socket without transport

2025-02-17 Thread Michal Luczaj
+ b/net/vmw_vsock/vsock_bpf.c >> @@ -87,7 +87,7 @@ static int vsock_bpf_recvmsg(struct sock *sk, struct >> msghdr *msg, >> lock_sock(sk); >> vsk = vsock_sk(sk); >> >> -if (!vsk->transport) { >> +if (WARN_ON_ONCE(!vsk->transport)) { &

Re: [PATCH net 2/4] vsock/bpf: Warn on socket without transport

2025-02-17 Thread Stefano Garzarella
ckmap expert, so I don't understand why here print an error. Since there was already a check, I expected it to be a case that can happen, but instead calling `rcvmsg()` on a socket not yet connected is impossible? Thanks, Stefano

Re: [Patch net 2/2] vsock/virtio: Don't reset the created SOCKET during suspend to ram

2025-02-15 Thread Markus Elfring
… > and it will cause that socket can not be unusable after resume. … I find such a wording confusing. Can the change description become clearer? Regards, Markus

[PATCH net 2/4] vsock/bpf: Warn on socket without transport

2025-02-13 Thread Michal Luczaj
In the spirit of commit 91751e248256 ("vsock: prevent null-ptr-deref in vsock_*[has_data|has_space]"), armorize the "impossible" cases with a warning. Fixes: 634f1a7110b4 ("vsock: support sockmap") Signed-off-by: Michal Luczaj --- net/vmw_vsock/af_vsock.c | 3 +++ net/vmw_vsock/vsock_bpf.c | 2

Re: [PATCH 2/2] vsock/virtio: Don't reset the created SOCKET during s2r

2025-02-13 Thread Stefano Garzarella
push. On Fri, Feb 07, 2025 at 01:20:33PM +0800, Junnan Wu wrote: From: Ying Gao If suspend is executed during vsock communication and the socket is reset, the original socket will be unusable after resume. Why? (I mean for a good commit description) Judge the value of vdev->priv

RE: Re: [PATCH 2/2] vsock/virtio: Don't reset the created SOCKET during s2r

2025-02-12 Thread Junnan Wu
b 07, 2025 at 01:20:33PM +0800, Junnan Wu wrote: >>>From: Ying Gao >>> >>>If suspend is executed during vsock communication and the >>>socket is reset, the original socket will be unusable after resume. > >Why? (I mean for a good commit description) > >

Re: [Patch net 2/2] vsock/virtio: Don't reset the created SOCKET during suspend to ram

2025-02-11 Thread Stefano Garzarella
On Tue, Feb 11, 2025 at 03:19:22PM +0800, Junnan Wu wrote: Function virtio_vsock_vqs_del will be invoked in 2 cases virtio_vsock_remove() and virtio_vsock_freeze(). And when driver freeze, the connected socket will be set to TCP_CLOSE and it will cause that socket can not be unusable after

[Patch net 2/2] vsock/virtio: Don't reset the created SOCKET during suspend to ram

2025-02-10 Thread Junnan Wu
Function virtio_vsock_vqs_del will be invoked in 2 cases virtio_vsock_remove() and virtio_vsock_freeze(). And when driver freeze, the connected socket will be set to TCP_CLOSE and it will cause that socket can not be unusable after resume. Refactor function virtio_vsock_vqs_del to differentiate

Re: [PATCH bpf-next/net v2 5/7] bpf: Acquire and release mptcp socket

2025-01-23 Thread Martin KaFai Lau
On 12/19/24 7:46 AM, Matthieu Baerts (NGI0) wrote: From: Geliang Tang The KF_TRUSTED_ARGS flag is used for bpf_iter_mptcp_subflow_new, it indicates that the all pointer arguments are valid. It's necessary to add a KF_ACQUIRE helper to get valid "msk". This feels wrong. It forces an unnecessar

Re: [PATCH net v2 4/5] vsock: reset socket state when de-assigning the transport

2025-01-10 Thread Stefano Garzarella
On Fri, Jan 10, 2025 at 11:56:28AM +0100, Luigi Leonardi wrote: On Fri, Jan 10, 2025 at 09:35:10AM +0100, Stefano Garzarella wrote: Transport's release() and destruct() are called when de-assigning the vsock transport. These callbacks can touch some socket state like sock flags, sk_state

Re: [PATCH net v2 4/5] vsock: reset socket state when de-assigning the transport

2025-01-10 Thread Luigi Leonardi
On Fri, Jan 10, 2025 at 09:35:10AM +0100, Stefano Garzarella wrote: Transport's release() and destruct() are called when de-assigning the vsock transport. These callbacks can touch some socket state like sock flags, sk_state, and peer_shutdown. Since we are reassigning the socket to

[PATCH net v2 4/5] vsock: reset socket state when de-assigning the transport

2025-01-10 Thread Stefano Garzarella
Transport's release() and destruct() are called when de-assigning the vsock transport. These callbacks can touch some socket state like sock flags, sk_state, and peer_shutdown. Since we are reassigning the socket to a new transport during vsock_connect(), let's reset these fields to ha

[PATCH bpf-next/net v2 5/7] bpf: Acquire and release mptcp socket

2024-12-19 Thread Matthieu Baerts (NGI0)
From: Geliang Tang The KF_TRUSTED_ARGS flag is used for bpf_iter_mptcp_subflow_new, it indicates that the all pointer arguments are valid. It's necessary to add a KF_ACQUIRE helper to get valid "msk". This patch adds bpf_mptcp_sock_acquire() and bpf_mptcp_sock_release() helpers for this. Increas

[PATCH net v8 3/3] vsock/test: verify socket options after setting them

2024-12-03 Thread Konstantin Shkolnyy
r *control_host, for (ai = result; ai; ai = ai->ai_next) { int fd; - int val = 1; fd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); if (fd < 0) @@ -65,11 +65,8 @@ void control_init(const char

[PATCH net v7 3/3] vsock/test: verify socket options after setting them

2024-12-02 Thread Konstantin Shkolnyy
r *control_host, for (ai = result; ai; ai = ai->ai_next) { int fd; - int val = 1; fd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); if (fd < 0) @@ -65,11 +65,8 @@ void control_init(const char

Re: [PATCH v6 3/3] vsock/test: verify socket options after setting them

2024-11-18 Thread Konstantin Shkolnyy
On 11/14/2024 04:28, Stefano Garzarella wrote: On Wed, Nov 13, 2024 at 08:35:57AM -0600, Konstantin Shkolnyy wrote: [...] diff --git a/tools/testing/vsock/msg_zerocopy_common.c b/tools/ testing/vsock/msg_zerocopy_common.c index 5a4bdf7b5132..8622e5a0f8b7 100644 --- a/tools/testing/vsock/msg_ze

Re: [PATCH v6 3/3] vsock/test: verify socket options after setting them

2024-11-14 Thread Stefano Garzarella
@ void control_init(const char *control_host, for (ai = result; ai; ai = ai->ai_next) { int fd; - int val = 1; fd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); if (fd < 0) @@ -65,11 +65,8

[PATCH v6 3/3] vsock/test: verify socket options after setting them

2024-11-13 Thread Konstantin Shkolnyy
= result; ai; ai = ai->ai_next) { int fd; - int val = 1; fd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); if (fd < 0) @@ -65,11 +65,8 @@ void control_init(const char *control_host,

Re: [PATCH v5 3/3] vsock/test: verify socket options after setting them

2024-11-12 Thread Stefano Garzarella
On Tue, Nov 12, 2024 at 09:18:48AM -0600, Konstantin Shkolnyy wrote: On 11/12/2024 02:58, Stefano Garzarella wrote: On Thu, Nov 07, 2024 at 07:17:26PM -0600, Konstantin Shkolnyy wrote: Replace setsockopt() calls with calls to functions that follow setsockopt() with getsockopt() and check that t

Re: [PATCH v5 3/3] vsock/test: verify socket options after setting them

2024-11-12 Thread Konstantin Shkolnyy
On 11/12/2024 02:58, Stefano Garzarella wrote: On Thu, Nov 07, 2024 at 07:17:26PM -0600, Konstantin Shkolnyy wrote: Replace setsockopt() calls with calls to functions that follow setsockopt() with getsockopt() and check that the returned value and its size are the same as have been set. Signed-

Re: [PATCH v5 3/3] vsock/test: verify socket options after setting them

2024-11-12 Thread Stefano Garzarella
= result; ai; ai = ai->ai_next) { int fd; - int val = 1; fd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); if (fd < 0) @@ -65,11 +65,9 @@ void control_init(const char *control_host, break;

[PATCH bpf-next/net 3/5] bpf: Acquire and release mptcp socket

2024-11-08 Thread Matthieu Baerts (NGI0)
From: Geliang Tang The KF_TRUSTED_ARGS flag is used for bpf_iter_mptcp_subflow_new, it indicates that the all pointer arguments are valid. It's necessary to add a KF_ACQUIRE helper to get valid "msk". This patch adds bpf_mptcp_sock_acquire() and bpf_mptcp_sock_release() helpers for this. Increas

[PATCH v5 3/3] vsock/test: verify socket options after setting them

2024-11-07 Thread Konstantin Shkolnyy
for (ai = result; ai; ai = ai->ai_next) { int fd; - int val = 1; fd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); if (fd < 0) @@ -65,11 +65,9 @@ void control_init(const char *control_host,

Re: [PATCH net-next v3 9/9] Revert "net: do not leave a dangling sk pointer, when socket creation fails"

2024-10-15 Thread Eric Dumazet
On Mon, Oct 14, 2024 at 11:42 PM Kuniyuki Iwashima wrote: > > From: Ignat Korchagin > Date: Mon, 14 Oct 2024 16:38:08 +0100 > > This reverts commit 6cd4a78d962bebbaf8beb7d2ead3f34120e3f7b2. > > > > inet/inet6->create() implementations have been fixed to explicitly NULL the > > allocated sk object

Re: [PATCH net-next v04 3/3] selftests: net/psock_fanout: unbound socket fanout

2024-10-14 Thread Willem de Bruijn
Gur Stavi wrote: > Add a test that validates that an unbound packet socket cannot create/join > a fanout group. > > Signed-off-by: Gur Stavi Reviewed-by: Willem de Bruijn

Re: [PATCH net-next v04 2/3] selftests: net/psock_fanout: socket joins fanout when link is down

2024-10-14 Thread Willem de Bruijn
Gur Stavi wrote: > Modify test_control_group to have toggle parameter. > When toggle is non-zero, loopback device will be set down for the > initialization of fd[1] which is still expected to successfully join > the fanout. > > Signed-off-by: Gur Stavi Reviewed-by: Willem de Bruijn

Re: [PATCH net-next v04 1/3] af_packet: allow fanout_add when socket is not RUNNING

2024-10-14 Thread Willem de Bruijn
Gur Stavi wrote: > PACKET socket can retain its fanout membership through link down and up > and leave a fanout while closed regardless of link state. > However, socket was forbidden from joining a fanout while it was not > RUNNING. > > This patch allows PACKET socket to joi

Re: [PATCH net-next v3 9/9] Revert "net: do not leave a dangling sk pointer, when socket creation fails"

2024-10-14 Thread Kuniyuki Iwashima
From: Ignat Korchagin Date: Mon, 14 Oct 2024 16:38:08 +0100 > This reverts commit 6cd4a78d962bebbaf8beb7d2ead3f34120e3f7b2. > > inet/inet6->create() implementations have been fixed to explicitly NULL the > allocated sk object on error. > > A warning was put in place to make sure any future chang

[PATCH net-next v3 9/9] Revert "net: do not leave a dangling sk pointer, when socket creation fails"

2024-10-14 Thread Ignat Korchagin
3830,9 +3830,6 @@ void sk_common_release(struct sock *sk) sk->sk_prot->unhash(sk); - if (sk->sk_socket) - sk->sk_socket->sk = NULL; - /* * In this point socket cannot receive new packets, but it is possible * that some packets

[PATCH net-next v04 3/3] selftests: net/psock_fanout: unbound socket fanout

2024-10-13 Thread Gur Stavi
Add a test that validates that an unbound packet socket cannot create/join a fanout group. Signed-off-by: Gur Stavi --- tools/testing/selftests/net/psock_fanout.c | 36 ++ 1 file changed, 36 insertions(+) diff --git a/tools/testing/selftests/net/psock_fanout.c b/tools

[PATCH net-next v04 2/3] selftests: net/psock_fanout: socket joins fanout when link is down

2024-10-13 Thread Gur Stavi
@@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -59,6 +60,33 @@ static uint32_t cfg_max_num_members; +static void loopback_set_up_down(int state_up) +{ + struct ifreq ifreq = {}; + int fd, err; + + fd = socket(AF_PACKET, SOCK_RAW, 0

[PATCH net-next v04 1/3] af_packet: allow fanout_add when socket is not RUNNING

2024-10-13 Thread Gur Stavi
PACKET socket can retain its fanout membership through link down and up and leave a fanout while closed regardless of link state. However, socket was forbidden from joining a fanout while it was not RUNNING. This patch allows PACKET socket to join fanout while not RUNNING. Socket can be RUNNING

RE: [PATCH net-next v02 1/2] af_packet: allow fanout_add when socket is not RUNNING

2024-10-11 Thread Willem de Bruijn
econdary priority. Since we did identify this corner case in our > > > discussion I think we should still use [2]. > > > I don't consider the code complex. In fact, to me, the ifindex clause > > > is a more understandable direct reason for failure than the proto w

RE: [PATCH net-next v02 1/2] af_packet: allow fanout_add when socket is not RUNNING

2024-10-11 Thread Gur Stavi
t; > I don't consider the code complex. In fact, to me, the ifindex clause > > is a more understandable direct reason for failure than the proto which > > is indirect. Having the ifindex clause helps figuring out the proto > > clause. > > It's interesting

RE: [PATCH net-next v02 1/2] af_packet: allow fanout_add when socket is not RUNNING

2024-10-11 Thread Willem de Bruijn
dable direct reason for failure than the proto which > is indirect. Having the ifindex clause helps figuring out the proto > clause. It's interesting that the unlisted fix does not return ENODEV, but returns success and leaves the socket in an unbound state, equivalent to binding to ETH_

RE: [PATCH net-next v02 1/2] af_packet: allow fanout_add when socket is not RUNNING

2024-10-11 Thread Willem de Bruijn
->bind_lock); > > > > > > > > > >> - if (packet_sock_flag(po, PACKET_SOCK_RUNNING) && > > > > > > > > > >> - match->type == type && > > > > > > > > &g

RE: [PATCH net-next v02 1/2] af_packet: allow fanout_add when socket is not RUNNING

2024-10-11 Thread Gur Stavi
> > If we don't care about opening up fanout groups to ETH_P_NONE, then > patch v2 seems sufficient. If explicitly blocking this, the ENXIO > return can be added, but ideally without touching the other lines. I don't think that allowing ETH_P_NONE is relevant. In my opinion the 2 options that sho

RE: [PATCH net-next v02 1/2] af_packet: allow fanout_add when socket is not RUNNING

2024-10-10 Thread Gur Stavi
; >> -if (packet_sock_flag(po, PACKET_SOCK_RUNNING) && > > > > > > > > >> -match->type == type && > > > > > > > > >> +if (match->type == type && > > > > > > > > >>

RE: [PATCH net-next v02 1/2] af_packet: allow fanout_add when socket is not RUNNING

2024-10-10 Thread Willem de Bruijn
(po, PACKET_SOCK_RUNNING) && > > > > > > > >> - match->type == type && > > > > > > > >> + if (match->type == type && > > > > > > > >>match->prot_hook.type == po->prot_hook.ty

RE: [PATCH net-next v02 1/2] af_packet: allow fanout_add when socket is not RUNNING

2024-10-10 Thread Gur Stavi
match->type == type && > > > > > > >> +if (match->type == type && > > > > > > >> match->prot_hook.type == po->prot_hook.type && > > > > > > >> match->prot

RE: [PATCH net-next v03 1/3] af_packet: allow fanout_add when socket is not RUNNING

2024-10-10 Thread Gur Stavi
> Gur Stavi wrote: > > PACKET socket can retain its fanout membership through link down and up > > and leave a fanout while closed regardless of link state. > > However, socket was forbidden from joining a fanout while it was not > > RUNNING. > > > > This pa

RE: [PATCH net-next v02 1/2] af_packet: allow fanout_add when socket is not RUNNING

2024-10-10 Thread Willem de Bruijn
>type == type && > > > > > >>match->prot_hook.type == po->prot_hook.type && > > > > > >>match->prot_hook.dev == po->prot_hook.dev) { > > > > > > > > > > > > Remaining unaddress

Re: [PATCH net-next v03 1/3] af_packet: allow fanout_add when socket is not RUNNING

2024-10-10 Thread Willem de Bruijn
Gur Stavi wrote: > PACKET socket can retain its fanout membership through link down and up > and leave a fanout while closed regardless of link state. > However, socket was forbidden from joining a fanout while it was not > RUNNING. > > This patch allows PACKET socket to joi

RE: [PATCH net-next v02 1/2] af_packet: allow fanout_add when socket is not RUNNING

2024-10-10 Thread Gur Stavi
> I realized another possible problem. We should consider adding ifindex > Field to struct packet_fanout to be used for lookup of an existing match. > There is little sense to bind sockets to different interfaces and then > put them in the same fanout group. > If you agree, I can prepare a separate

RE: [PATCH net-next v03 1/3] af_packet: allow fanout_add when socket is not RUNNING

2024-10-10 Thread Gur Stavi
> Subject: [PATCH net-next v03 1/3] af_packet: allow fanout_add when socket > is not RUNNING > > PACKET socket can retain its fanout membership through link down and up > and leave a fanout while closed regardless of link state. > However, socket was forbidden from joining a f

[PATCH net-next v03 3/3] selftests: net/psock_fanout: unbound socket fanout

2024-10-10 Thread Gur Stavi
Add a test that validates that an unbound packet socket cannot create/join a fanout group. Signed-off-by: Gur Stavi --- tools/testing/selftests/net/psock_fanout.c | 36 ++ 1 file changed, 36 insertions(+) diff --git a/tools/testing/selftests/net/psock_fanout.c b/tools

[PATCH net-next v03 2/3] selftests: net/psock_fanout: socket joins fanout when link is down

2024-10-10 Thread Gur Stavi
@@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -59,6 +60,33 @@ static uint32_t cfg_max_num_members; +static void loopback_set_up_down(int state_up) +{ + struct ifreq ifreq = {}; + int fd, err; + + fd = socket(AF_PACKET, SOCK_RAW, 0

[PATCH net-next v03 1/3] af_packet: allow fanout_add when socket is not RUNNING

2024-10-10 Thread Gur Stavi
PACKET socket can retain its fanout membership through link down and up and leave a fanout while closed regardless of link state. However, socket was forbidden from joining a fanout while it was not RUNNING. This patch allows PACKET socket to join fanout while not RUNNING. The previous test for

RE: [PATCH net-next v02 1/2] af_packet: allow fanout_add when socket is not RUNNING

2024-10-10 Thread Gur Stavi
spin_lock(&po->bind_lock); > > > > >> -if (packet_sock_flag(po, PACKET_SOCK_RUNNING) && > > > > >> -match->type == type && > > > > >> +if (match->type == type && > > > > >&

RE: [PATCH net-next v02 1/2] af_packet: allow fanout_add when socket is not RUNNING

2024-10-09 Thread Willem de Bruijn
po->bind_lock); > > > >> - if (packet_sock_flag(po, PACKET_SOCK_RUNNING) && > > > >> - match->type == type && > > > >> + if (match->type == type && > > > >> match->prot_hook.ty

RE: [PATCH net-next v02 1/2] af_packet: allow fanout_add when socket is not RUNNING

2024-10-09 Thread Gur Stavi
ket_sock_flag(po, PACKET_SOCK_RUNNING) && > > >> -match->type == type && > > >> +if (match->type == type && > > >> match->prot_hook.type == po->prot_hook.type && > > >>

Re: [PATCH net-next v02 1/2] af_packet: allow fanout_add when socket is not RUNNING

2024-10-09 Thread Willem de Bruijn
&& > >> - match->type == type && > >> + if (match->type == type && > >>match->prot_hook.type == po->prot_hook.type && > >>match->prot_hook.dev == po->prot_hook.dev) { > > > > Remai

Re: [PATCH net-next v02 1/2] af_packet: allow fanout_add when socket is not RUNNING

2024-10-09 Thread Gur Stavi
match->type == type && >> +if (match->type == type && >> match->prot_hook.type == po->prot_hook.type && >> match->prot_hook.dev == po->prot_hook.dev) { > > Remaining unaddressed issue is that the socket can now be added > b

Re: [PATCH net-next v02 1/2] af_packet: allow fanout_add when socket is not RUNNING

2024-10-08 Thread Willem de Bruijn
Gur Stavi wrote: > PACKET socket can retain its fanout membership through link down and up > and leave a fanout while closed regardless of link state. > However, socket was forbidden from joining a fanout while it was not > RUNNING. > > This patch allows PACKET socket to joi

[PATCH net-next v02 2/2] selftests: net/psock_fanout: socket joins fanout when link is down

2024-10-08 Thread Gur Stavi
@@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -59,6 +60,33 @@ static uint32_t cfg_max_num_members; +static void loopback_set_up_down(int state_up) +{ + struct ifreq ifreq = {}; + int fd, err; + + fd = socket(AF_PACKET, SOCK_RAW, 0

[PATCH net-next v02 1/2] af_packet: allow fanout_add when socket is not RUNNING

2024-10-08 Thread Gur Stavi
PACKET socket can retain its fanout membership through link down and up and leave a fanout while closed regardless of link state. However, socket was forbidden from joining a fanout while it was not RUNNING. This patch allows PACKET socket to join fanout while not RUNNING. Signed-off-by: Gur

Re: [PATCH net-next v3 1/3] vsock: add support for SIOCOUTQ ioctl for all vsock socket types.

2024-06-28 Thread kernel test robot
Hi Luigi, kernel test robot noticed the following build warnings: [auto build test WARNING on 50b70845fc5c22cf7e7d25b57d57b3dca1725aa5] url: https://github.com/intel-lab-lkp/linux/commits/Luigi-Leonardi-via-B4-Relay/vsock-add-support-for-SIOCOUTQ-ioctl-for-all-vsock-socket-types/20240627

Re: [PATCH net-next v3 1/3] vsock: add support for SIOCOUTQ ioctl for all vsock socket types.

2024-06-28 Thread Stefano Garzarella
rom: Luigi Leonardi Add support for ioctl(s) for SOCK_STREAM SOCK_SEQPACKET and SOCK_DGRAM in AF_VSOCK. The only ioctl available is SIOCOUTQ/TIOCOUTQ, which returns the number of unsent bytes in the socket. This information is transport-specific and is delegated to them using a callback. Suggested-b

Re: [PATCH net-next v3 1/3] vsock: add support for SIOCOUTQ ioctl for all vsock socket types.

2024-06-27 Thread kernel test robot
Hi Luigi, kernel test robot noticed the following build warnings: [auto build test WARNING on 50b70845fc5c22cf7e7d25b57d57b3dca1725aa5] url: https://github.com/intel-lab-lkp/linux/commits/Luigi-Leonardi-via-B4-Relay/vsock-add-support-for-SIOCOUTQ-ioctl-for-all-vsock-socket-types/20240627

Re: [PATCH net-next v3 1/3] vsock: add support for SIOCOUTQ ioctl for all vsock socket types.

2024-06-27 Thread kernel test robot
Hi Luigi, kernel test robot noticed the following build warnings: [auto build test WARNING on 50b70845fc5c22cf7e7d25b57d57b3dca1725aa5] url: https://github.com/intel-lab-lkp/linux/commits/Luigi-Leonardi-via-B4-Relay/vsock-add-support-for-SIOCOUTQ-ioctl-for-all-vsock-socket-types/20240627

[PATCH net-next v3 1/3] vsock: add support for SIOCOUTQ ioctl for all vsock socket types.

2024-06-26 Thread Luigi Leonardi via B4 Relay
From: Luigi Leonardi Add support for ioctl(s) for SOCK_STREAM SOCK_SEQPACKET and SOCK_DGRAM in AF_VSOCK. The only ioctl available is SIOCOUTQ/TIOCOUTQ, which returns the number of unsent bytes in the socket. This information is transport-specific and is delegated to them using a callback

Re: [PATCH net-next v5 0/7] net: pass receive socket to drop tracepoint

2024-06-19 Thread patchwork-bot+netdevbpf
blems, it also has some limitation with drops on the local > receive path: this tracepoint can only inspect the dropped skb itself, > but such skb might not carry enough information to: > > 1. determine in which netns/container this skb gets dropped > 2. determine by which socket/se

[PATCH net-next v5 0/7] net: pass receive socket to drop tracepoint

2024-06-17 Thread Yan Zhai
might not carry enough information to: 1. determine in which netns/container this skb gets dropped 2. determine by which socket/service this skb oughts to be received The 1st issue is because skb->dev is the only member field with valid netns reference. But skb->dev can get cleared or reuse

[PATCH v4 net-next 0/7] net: pass receive socket to drop tracepoint

2024-06-11 Thread Yan Zhai
might not carry enough information to: 1. determine in which netns/container this skb gets dropped 2. determine by which socket/service this skb oughts to be received The 1st issue is because skb->dev is the only member field with valid netns reference. But skb->dev can get cleared or reuse

[RFC v3 net-next 0/7] net: pass receive socket to drop tracepoint

2024-06-04 Thread Yan Zhai
might not carry enough information to: 1. determine in which netns/container this skb gets dropped 2. determine by which socket/service this skb oughts to be received The 1st issue is because skb->dev is the only member field with valid netns reference. But skb->dev can get cleared or reuse

Re: Avoid unprivileged splice(file->)/(->socket) pipe exclusion

2023-12-25 Thread Ahelenia Ziemiańska
On Tue, Dec 26, 2023 at 12:34:44AM +0300, Askar Safin wrote: > In > https://lore.kernel.org/lkml/CAHk-=wgG_2cmHgZwKjydi7=iimyhyn8aessnbm9xq9ufbau...@mail.gmail.com/ > Linus said: > > I have grown to pretty much hate > > splice() over the years, just because it's been a constant source of > > sorro

Re: Avoid unprivileged splice(file->)/(->socket) pipe exclusion

2023-12-25 Thread Askar Safin
Hi, Ahelenia Ziemiańska! Thanks a lot for all this splice-related hard work! In https://lore.kernel.org/lkml/CAHk-=wgG_2cmHgZwKjydi7=iimyhyn8aessnbm9xq9ufbau...@mail.gmail.com/ Linus said: > I have grown to pretty much hate > splice() over the years, just because it's been a constant source of >

[PATCH v2 00/11] Avoid unprivileged splice(file->)/(->socket) pipe exclusion

2023-12-20 Thread Ahelenia Ziemiańska
ocess is killed. This trivially denies service to: * any hypothetical pipe-based log collexion system * all nullmailer installations * me, personally, when I'm pasting stuff into qemu -serial chardev:pipe A symmetric situation happens for splicing(pipe -> socket): the pipe is locked for as lo

Re: [PATCH net] vsock/virtio: free queued packets when closing socket

2021-04-20 Thread patchwork-bot+netdevbpf
Hello: This patch was applied to netdev/net.git (refs/heads/master): On Tue, 20 Apr 2021 13:07:27 +0200 you wrote: > As reported by syzbot [1], there is a memory leak while closing the > socket. We partially solved this issue with commit ac03046ece2b > ("vsock/virtio: free pack

Re: [PATCH v3 bpf-next 00/11] Socket migration for SO_REUSEPORT.

2021-04-20 Thread Eric Dumazet
On 4/20/21 5:41 PM, Kuniyuki Iwashima wrote: > The SO_REUSEPORT option allows sockets to listen on the same port and to > accept connections evenly. However, there is a defect in the current > implementation [1]. When a SYN packet is received, the connection is tied > to a list

[PATCH v3 bpf-next 09/11] bpf: Support socket migration by eBPF.

2021-04-20 Thread Kuniyuki Iwashima
This patch introduces a new bpf_attach_type for BPF_PROG_TYPE_SK_REUSEPORT to check if the attached eBPF program is capable of migrating sockets. When the eBPF program is attached, we run it for socket migration if the expected_attach_type is BPF_SK_REUSEPORT_SELECT_OR_MIGRATE or net.ipv4

[PATCH v3 bpf-next 00/11] Socket migration for SO_REUSEPORT.

2021-04-20 Thread Kuniyuki Iwashima
The SO_REUSEPORT option allows sockets to listen on the same port and to accept connections evenly. However, there is a defect in the current implementation [1]. When a SYN packet is received, the connection is tied to a listening socket. Accordingly, when the listener is closed, in-flight

[PATCH net] vsock/virtio: free queued packets when closing socket

2021-04-20 Thread Stefano Garzarella
As reported by syzbot [1], there is a memory leak while closing the socket. We partially solved this issue with commit ac03046ece2b ("vsock/virtio: free packets during the socket release"), but we forgot to drain the RX queue when the socket is definitely closed by the scheduled work.

Re: [RFC PATCH v8 19/19] af_vsock: serialize writes to shared socket

2021-04-14 Thread Arseny Krasnov
On 13.04.2021 15:47, Arseny Krasnov wrote: > This add logic, that serializes write access to single socket > by multiple threads. It is implemented be adding field with TID > of current writer. When writer tries to send something, it checks > that field is -1(free), else it sleep in

[RFC PATCH v8 19/19] af_vsock: serialize writes to shared socket

2021-04-13 Thread Arseny Krasnov
This add logic, that serializes write access to single socket by multiple threads. It is implemented be adding field with TID of current writer. When writer tries to send something, it checks that field is -1(free), else it sleep in the same way as waiting for free space at peers' side.

[RFC PATCH v8 01/19] af_vsock: update functions for connectible socket

2021-04-13 Thread Arseny Krasnov
vsock_pending_work(struct work_struct *work) / SOCKET OPERATIONS / -static int __vsock_bind_stream(struct vsock_sock *vsk, - struct sockaddr_vm *addr) +static int __vsock_bind_connectible(struct vsock_sock *vsk, + struct

[PATCH net-next v2 7/7] net: stmmac: Add TX via XDP zero-copy socket

2021-04-13 Thread Ong Boon Leong
We add the support of XDP ZC TX submission and cleaning into stmmac_tx_clean(). The function is made to clean as many TX complete frames as possible, i.e. limit by priv->dma_tx_size instead of NAPI budget. For TX ring that is associated with XSK pool, the function stmmac_xdp_xmit_zc() is introduced

[PATCH net-next 7/7] net: stmmac: Add TX via XDP zero-copy socket

2021-04-12 Thread Ong Boon Leong
We add the support of XDP ZC TX submission and cleaning into stmmac_tx_clean(). The function is made to clean as many TX complete frames as possible, i.e. limit by priv->dma_tx_size instead of NAPI budget. For TX ring that is associated with XSK pool, the function stmmac_xdp_xmit_zc() is introduced

[PATCH 5.11 104/210] xfrm: Use actual socket sk instead of skb socket for xfrm_output_resume

2021-04-12 Thread Greg Kroah-Hartman
("l2tp: keep original skb ownership") this worked fine as the sk attached to the skb was changed from the dot1q encapsulated interface to the sk for the tunnel which meant the interface bound to the sk and the interface bound to the skb were identical. Commit 46d6c5ae953c ("netfilter: us

  1   2   3   4   5   6   7   8   9   10   >