On 10/26/2024 12:10 AM, Ferruh Yigit wrote: > On 10/17/2024 2:38 AM, Stephen Hemminger wrote: >> On Sun, 13 Oct 2024 16:59:47 +0300 >> Gur Stavi <gur.st...@huawei.com> wrote: >> >>> When creating AF_PACKET socket with specified protocol it is >>> immediately implicitly bound to any existing interface and >>> becomes RUNNING. Calling bind on such socket is affectively unbind >>> from "any interface", then bind to the specific interface. >>> >>> When creating socket with 0 as protocol, it is created in non-RUNNING >>> state, then it can be bound to interface and protocol in a single bind >>> call and switch to RUNNING state. >>> >>> Especially with ETH_P_ALL, binding to any interface is not a good idea. >>> It is safer and faster to use the 2nd approach. >>> >>> This patch replaces protocol in socket creation from ETH_P_ALL to 0. >>> >>> Signed-off-by: Gur Stavi <gur.st...@huawei.com> >> >> This makes sense see packet(7) man page: >> >> By default, all packets of the specified protocol type are passed to >> a >> packet socket. To get packets only from a specific interface >> use >> bind(2) specifying an address in a struct sockaddr_ll to bind the >> packet >> socket to an interface. Fields used for binding are sll_family >> (should >> be AF_PACKET), sll_protocol, and sll_ifindex. >> >> So there is a small window where the packet socket could pick up junk before >> the bind from other interfaces. >> > > Thanks, this answers some of my questions in this thread, also I did > some experiment and verified the same. > > I agree this change is more close the intention of the driver (driver is > not to get packets from all interfaces), hence: > > Acked-by: Ferruh Yigit <ferruh.yi...@amd.com> >
Series applied to dpdk-next-net/main, thanks.