--- zzzz-none-000/linux-4.4.271/net/ethernet/eth.c 2021-06-03 06:22:09.000000000 +0000 +++ maple-fsgw-759/linux-4.4.271/net/ethernet/eth.c 2023-12-20 10:37:40.000000000 +0000 @@ -140,6 +140,18 @@ } EXPORT_SYMBOL(eth_get_headlen); +static inline bool +eth_check_local_mask(const void *addr1, const void *addr2, const void *mask) +{ + const u16 *a1 = addr1; + const u16 *a2 = addr2; + const u16 *m = mask; + + return (((a1[0] ^ a2[0]) & ~m[0]) | + ((a1[1] ^ a2[1]) & ~m[1]) | + ((a1[2] ^ a2[2]) & ~m[2])); +} + /** * eth_type_trans - determine the packet's protocol ID. * @skb: received socket data @@ -156,6 +168,12 @@ const struct ethhdr *eth; skb->dev = dev; + +#ifdef CONFIG_ETHERNET_PACKET_MANGLE + if (dev->eth_mangle_rx) + dev->eth_mangle_rx(dev, skb); +#endif + skb_reset_mac_header(skb); eth = (struct ethhdr *)skb->data; @@ -168,8 +186,12 @@ skb->pkt_type = PACKET_MULTICAST; } else if (unlikely(!ether_addr_equal_64bits(eth->h_dest, - dev->dev_addr))) + dev->dev_addr))) { skb->pkt_type = PACKET_OTHERHOST; + if (eth_check_local_mask(eth->h_dest, dev->dev_addr, + dev->local_addr_mask)) + skb->gro_skip = 1; + } /* * Some variants of DSA tagging don't have an ethertype field