[BRIDGE]: Use ether_compare
authorStephen Hemminger <shemminger@osdl.org>
Tue, 25 Oct 2005 22:04:59 +0000 (15:04 -0700)
committerArnaldo Carvalho de Melo <acme@mandriva.com>
Mon, 31 Oct 2005 18:34:10 +0000 (16:34 -0200)
Use compare_ether_addr in bridge code.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
net/bridge/br_fdb.c
net/bridge/br_input.c
net/bridge/br_stp_if.c

index 24396b914d11634f6e3fe26d9c3c06a9d94ded5c..1f08a59b51eaabf7aa5ca5062f94e258c5a315c2 100644 (file)
@@ -86,8 +86,8 @@ void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr)
                                struct net_bridge_port *op;
                                list_for_each_entry(op, &br->port_list, list) {
                                        if (op != p && 
-                                           !memcmp(op->dev->dev_addr,
-                                                   f->addr.addr, ETH_ALEN)) {
+                                           !compare_ether_addr(op->dev->dev_addr,
+                                                               f->addr.addr)) {
                                                f->dst = op;
                                                goto insert;
                                        }
@@ -151,8 +151,8 @@ void br_fdb_delete_by_port(struct net_bridge *br, struct net_bridge_port *p)
                                struct net_bridge_port *op;
                                list_for_each_entry(op, &br->port_list, list) {
                                        if (op != p && 
-                                           !memcmp(op->dev->dev_addr,
-                                                   f->addr.addr, ETH_ALEN)) {
+                                           !compare_ether_addr(op->dev->dev_addr,
+                                                               f->addr.addr)) {
                                                f->dst = op;
                                                goto skip_delete;
                                        }
@@ -174,7 +174,7 @@ struct net_bridge_fdb_entry *__br_fdb_get(struct net_bridge *br,
        struct net_bridge_fdb_entry *fdb;
 
        hlist_for_each_entry_rcu(fdb, h, &br->hash[br_mac_hash(addr)], hlist) {
-               if (!memcmp(fdb->addr.addr, addr, ETH_ALEN)) {
+               if (!compare_ether_addr(fdb->addr.addr, addr)) {
                        if (unlikely(has_expired(br, fdb)))
                                break;
                        return fdb;
@@ -264,7 +264,7 @@ static inline struct net_bridge_fdb_entry *fdb_find(struct hlist_head *head,
        struct net_bridge_fdb_entry *fdb;
 
        hlist_for_each_entry_rcu(fdb, h, head, hlist) {
-               if (!memcmp(fdb->addr.addr, addr, ETH_ALEN))
+               if (!compare_ether_addr(fdb->addr.addr, addr))
                        return fdb;
        }
        return NULL;
index 9a45e6279c57c4f1eebb005f674b0284defe1151..b88220a64cd8e0a7009971cc09f6507fc3f9b117 100644 (file)
@@ -128,7 +128,7 @@ int br_handle_frame(struct net_bridge_port *p, struct sk_buff **pskb)
                        dest = eth_hdr(skb)->h_dest;
                }
 
-               if (!memcmp(p->br->dev->dev_addr, dest, ETH_ALEN))
+               if (!compare_ether_addr(p->br->dev->dev_addr, dest))
                        skb->pkt_type = PACKET_HOST;
 
                NF_HOOK(PF_BRIDGE, NF_BR_PRE_ROUTING, skb, skb->dev, NULL,
index 0da11ff05fa3a9a9d9c218f9a394735b137fac7f..ac09b6a2352317cde8ee4a43a2db1a01a3caab71 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <linux/kernel.h>
 #include <linux/smp_lock.h>
+#include <linux/etherdevice.h>
 
 #include "br_private.h"
 #include "br_private_stp.h"
@@ -133,10 +134,10 @@ static void br_stp_change_bridge_id(struct net_bridge *br,
        memcpy(br->dev->dev_addr, addr, ETH_ALEN);
 
        list_for_each_entry(p, &br->port_list, list) {
-               if (!memcmp(p->designated_bridge.addr, oldaddr, ETH_ALEN))
+               if (!compare_ether_addr(p->designated_bridge.addr, oldaddr))
                        memcpy(p->designated_bridge.addr, addr, ETH_ALEN);
 
-               if (!memcmp(p->designated_root.addr, oldaddr, ETH_ALEN))
+               if (!compare_ether_addr(p->designated_root.addr, oldaddr))
                        memcpy(p->designated_root.addr, addr, ETH_ALEN);
 
        }
@@ -157,12 +158,12 @@ void br_stp_recalculate_bridge_id(struct net_bridge *br)
 
        list_for_each_entry(p, &br->port_list, list) {
                if (addr == br_mac_zero ||
-                   memcmp(p->dev->dev_addr, addr, ETH_ALEN) < 0)
+                   compare_ether_addr(p->dev->dev_addr, addr) < 0)
                        addr = p->dev->dev_addr;
 
        }
 
-       if (memcmp(br->bridge_id.addr, addr, ETH_ALEN))
+       if (compare_ether_addr(br->bridge_id.addr, addr))
                br_stp_change_bridge_id(br, addr);
 }