[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
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 --- tools/testing/selftests/net/psock_fanout.c | 42

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

2024-10-13 Thread Gur Stavi
become RUNNING. Signed-off-by: Gur Stavi --- net/packet/af_packet.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index f8942062f776..2ff4b251842d 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c

[PATCH net-next v04 0/3] net: af_packet: allow joining a fanout when link is down

2024-10-13 Thread Gur Stavi
ot;leaving a fanout". V01: https://lore.kernel.org/netdev/cover.1728303615.git.gur.st...@huawei.com/ Gur Stavi (3): af_packet: allow fanout_add when socket is not RUNNING selftests: net/psock_fanout: socket joins fanout when link is down selftests: net/psock_fanout: unbound socket fanout net/packe

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

2024-10-11 Thread Gur Stavi
> Gur Stavi wrote: > > > > > > 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. >

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
> Gur Stavi wrote: > > > Gur Stavi wrote: > > > > > Gur Stavi wrote: > > > > > > > Gur Stavi wrote: > > > > > > > > >> @@ -1846,21 +1846,21 @@ static int fanout_add(struct > sock > &g

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

2024-10-10 Thread Gur Stavi
> Gur Stavi wrote: > > > Gur Stavi wrote: > > > > > Gur Stavi wrote: > > > > > > >> @@ -1846,21 +1846,21 @@ static int fanout_add(struct sock > *sk, > > > > > struct fanout_args *args) > > > > > > >

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 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 fanout while it was no

[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
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 --- tools/testing/selftests/net/psock_fanout.c | 42

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

2024-10-10 Thread Gur Stavi
RUNNING also implicitly tested that the socket is bound to a device. An explicit test of ifindex was added instead. Signed-off-by: Gur Stavi --- net/packet/af_packet.c | 35 +-- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/net/packet/af_packet.c

[PATCH net-next v03 0/3] net: af_packet: allow joining a fanout when link is down

2024-10-10 Thread Gur Stavi
7;t try to restore loopback state on failure. * Rephrase commit message about "leaving a fanout". V01: https://lore.kernel.org/netdev/cover.1728303615.git.gur.st...@huawei.com/ Gur Stavi (3): af_packet: allow fanout_add when socket is not RUNNING selftests: net/psock_fanout: socket jo

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

2024-10-10 Thread Gur Stavi
> Gur Stavi wrote: > > > Gur Stavi wrote: > > > > >> @@ -1846,21 +1846,21 @@ static int fanout_add(struct sock *sk, > > > struct fanout_args *args) > > > > >> err = -EINVAL; > > > > >> > > > > >>

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

2024-10-09 Thread Gur Stavi
> Gur Stavi wrote: > > >> @@ -1846,21 +1846,21 @@ static int fanout_add(struct sock *sk, > struct fanout_args *args) > > >> err = -EINVAL; > > >> > > >> spin_lock(&po->bind_lock); > > >> -if (pac

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

2024-10-09 Thread Gur Stavi
>> @@ -1846,21 +1846,21 @@ static int fanout_add(struct sock *sk, struct >> fanout_args *args) >> err = -EINVAL; >> >> spin_lock(&po->bind_lock); >> -if (packet_sock_flag(po, PACKET_SOCK_RUNNING) && >> -match->type == type && >> +if (match->type == type && >> mat

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

2024-10-08 Thread Gur Stavi
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 --- tools/testing/selftests/net/psock_fanout.c | 42

[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

[PATCH net-next v02 0/2] net: af_packet: allow joining a fanout when link is down

2024-10-08 Thread Gur Stavi
g a fanout". V01: https://lore.kernel.org/netdev/cover.1728303615.git.gur.st...@huawei.com/ Gur Stavi (2): af_packet: allow fanout_add when socket is not RUNNING selftests: net/psock_fanout: socket joins fanout when link is down net/packet/af_packet.c | 10 +++---