lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <52AEB8C4.1000000@huawei.com>
Date:	Mon, 16 Dec 2013 16:24:36 +0800
From:	Ding Tianhong <dingtianhong@...wei.com>
To:	"David S. Miller" <davem@...emloft.net>,
	Joe Perches <joe@...ches.com>, Netdev <netdev@...r.kernel.org>
Subject: [PATCH net-next v2 3/6] fddi: slight optimization of addr compare

Joe Perches add ether_addr_equal_unaligned to test if
possibly unaligned to u16 Ethernet addresses are equal.

If CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is set, this uses
the slightly faster generic routine ether_addr_equal,
otherwise this uses memcmp, and FDDI_K_ALEN is same with
ETH_ALEN.

Signed-off-by: Ding Tianhong <dingtianhong@...wei.com>
---
 net/802/fddi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/802/fddi.c b/net/802/fddi.c
index 9cda406..d536a81 100644
--- a/net/802/fddi.c
+++ b/net/802/fddi.c
@@ -41,6 +41,7 @@
 #include <linux/errno.h>
 #include <net/arp.h>
 #include <net/sock.h>
+#include <linux/etherdevice.h>
 
 /*
  * Create the FDDI MAC header for an arbitrary protocol layer
@@ -147,7 +148,7 @@ __be16 fddi_type_trans(struct sk_buff *skb, struct net_device *dev)
 
 	if (*fddi->daddr & 0x01)
 	{
-		if (memcmp(fddi->daddr, dev->broadcast, FDDI_K_ALEN) == 0)
+		if (ether_addr_equal_unaligned(fddi->daddr, dev->broadcast))
 			skb->pkt_type = PACKET_BROADCAST;
 		else
 			skb->pkt_type = PACKET_MULTICAST;
@@ -155,7 +156,7 @@ __be16 fddi_type_trans(struct sk_buff *skb, struct net_device *dev)
 
 	else if (dev->flags & IFF_PROMISC)
 	{
-		if (memcmp(fddi->daddr, dev->dev_addr, FDDI_K_ALEN))
+		if (!ether_addr_equal_unaligned(fddi->daddr, dev->dev_addr))
 			skb->pkt_type = PACKET_OTHERHOST;
 	}
 
-- 
1.8.0


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ