summaryrefslogtreecommitdiff
path: root/net/ethernet
diff options
context:
space:
mode:
authorRahul Rameshbabu <rrameshbabu@nvidia.com>2024-04-23 11:13:03 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-05-02 16:29:29 +0200
commit8e2c583c268003ce7241bb7cd839954273de4a5b (patch)
tree9979ee14b678cea51de5c870ce626e2dd6c6e567 /net/ethernet
parentba234a54ee56e5b23e763551e28fc220072d19c8 (diff)
downloadlinux-8e2c583c268003ce7241bb7cd839954273de4a5b.tar.gz
linux-8e2c583c268003ce7241bb7cd839954273de4a5b.tar.bz2
linux-8e2c583c268003ce7241bb7cd839954273de4a5b.zip
ethernet: Add helper for assigning packet type when dest address does not match device address
commit 6e159fd653d7ebf6290358e0330a0cb8a75cf73b upstream. Enable reuse of logic in eth_type_trans for determining packet type. Suggested-by: Sabrina Dubroca <sd@queasysnail.net> Cc: stable@vger.kernel.org Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com> Reviewed-by: Sabrina Dubroca <sd@queasysnail.net> Link: https://lore.kernel.org/r/20240423181319.115860-3-rrameshbabu@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/ethernet')
-rw-r--r--net/ethernet/eth.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index e02daa74e833..5ba7b460cbf7 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -164,17 +164,7 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
eth = (struct ethhdr *)skb->data;
skb_pull_inline(skb, ETH_HLEN);
- if (unlikely(!ether_addr_equal_64bits(eth->h_dest,
- dev->dev_addr))) {
- if (unlikely(is_multicast_ether_addr_64bits(eth->h_dest))) {
- if (ether_addr_equal_64bits(eth->h_dest, dev->broadcast))
- skb->pkt_type = PACKET_BROADCAST;
- else
- skb->pkt_type = PACKET_MULTICAST;
- } else {
- skb->pkt_type = PACKET_OTHERHOST;
- }
- }
+ eth_skb_pkt_type(skb, dev);
/*
* Some variants of DSA tagging don't have an ethertype field