>> > If now I add veth0 to a bridge (e.g. >> > >> > ip link add br0 type bridge >> > ip link set dev veth0 master br0 >> > >> > ) and continue to send on veth1 and receive on veth0 I don't receive >> > the packets any more. The other direction (veth0 sending, veth1 >> > receiving) still works fine. >> > >> > Each of the following changes allow to >> > receive again: >> > >> > a) take veth0 out of the bridge >> > b) bind(2) the receiving socket to br0 instead of veth0 >> > c) use .sll_protocol = htons(ETH_P_ALL) for bind(2) >> > >> > In the end only c) could be sensible (because I need to know the port >> > the packet entered the stack and that might well be bridged), but I >> > wonder why .sll_protocol = htons(ETH_P_MRP) seems to do the right thing >> > for an unbridged device but not for a bridged one. >> > >> > Is this a bug or a feature I don't understand? >> >> Packets are redirected to the bridge device in __netif_receive_skb_core >> at the rx_handler hook. > > OK, thanks for finding that place. It would have taken quite some of my > time to find it. > >> This happens after packets are passed to packet types attached to >> list ptype_all, which includes packet sockets with protocol ETH_P_ALL. >> But before packets are passed to protocol specific packet types (and >> sockets) attached to ptype_base[]. > > Still I wonder if there is something to fix in the kernel or if this > inconsistency is intended (or at least accepted).
It is established behavior.