RE: [PATCH net-next v03 1/3] af_packet: allow fanout_add when socket is not RUNNING
From: Gur Stavi
Date: Thu Oct 10 2024 - 06:39:16 EST
> 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 not
> RUNNING.
>
> This patch allows PACKET socket to join fanout while not RUNNING.
>
> The previous test for RUNNING also implicitly tested that the socket is
> bound to a device. An explicit test of ifindex was added instead.
I had some mess up with the send-email. I prepared the following more
complete git comment but sent the wrong patch. The code is still the same.
---
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 if it has a specified protocol. Either directly
from packet_create (being implicitly bound to any interface) or following
a successful bind. Socket RUNNING state is switched off if it is bound to
an interface that went down.
Instead of the test for RUNNING, this patch adds a test that socket can
receive packets before allowing it into a fanout group. Socket can
receive packets if it has a configured protocol and is bound to an
interface or bound to any interface.
The only difference between the previous test and the current test is
that the bound interface is allowed to have IFF_UP cleared.
---