Right now we have big "IFF_SIMPLEX" condition inside ether_output() which is responsible for
a) looping back copies for broadcast frames and
b) re-injecting back traffic to "our" mac address.
The goal of this review is to eliminate (b) to simplify code.
Given that the condition requires loop_copy to be non-zero (b) case is limited to AF_INET[6] families with unicast destinations (because source ether_shost would always be address of local interface).
(There are some nasty examples of lle w/ multicast macs (like Microsoft NLB), but this change does not seem to touch these).
Note that all lles for local IPv4/IPv6 addresses are marked with LLE_IFADDR flag on creation, so traffic to all these addresses are already handled by LLE_IFADDR check.
The only remaining case for (b) is existing lle with dst address of our system BUT without LLE_IFADDR flag (e.g. originated by other network node).
Such binding requests are discarded by ARP stack (see if_ether.c "match" label and "enaddr" check) because they were treated as locally-originated since the beginning. I was not able to find to find any guidelines on handling that in RFC 826 or RFC 5227.
ND's RFC 4861 also does not seem to restrict processing such bindings. Our stack accepts them as valid and installs appropriate records (see Test plan section). However, traffic to these entries flows back to input path via simloop() (which then turns in TTL-length cycle for all given packets (if forwarding is no) that can be considered as and attack).
My position is that we definitely don't want to cycle this traffic inside kernel so we either (1) put this to the wire (as done in the patch) or (2) add tunable like allow_local_mac ( as done for multicast: net.link.ether.inet.allow_multicast) in ARP/ND code.
The former is already implemented for BPF writes, and from code point of view it is "do not do anything special to handle this situation".
So, as the result we optimize TX part (no pf* call, no memcmp checks) and simplify future pseudo_AF_HDRCMPLT changes (no need to fake ethernet_header anymore).