> The Fixes tag is missing. Calling sendmsg on a packet socket bound to
> ETH_P_ALL goes back a long way. It is a user, not kernel, bug to do
> so.
I would argue it's not a bug at all - at least not the way you phrased it.
AFAIK it can/could be done correctly via specifying the protocol in
the sll_protocol field of the struct sockaddr_ll passed to sendmsg as
the target address.
Not specifying it would indeed be a bug (and a common one)
Hence I do agree it's better to automate this.
> But no more than sending on a socket bound to ETH_P_NONE (0), which
> was addressed in commit c72219b75fde ("packet: infer protocol from
> ethernet header if unset").
This is also not a bug. That's simply how you send when you don't
want to receive.
Other approaches add your socket to the receive hooks and slow the system
down (even if you add a bpf filter to unconditionally drop stuff).
ie. this is the *optimal* way to send frames.