aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@osdl.org>2005-10-25 18:04:59 -0400
committerArnaldo Carvalho de Melo <acme@mandriva.com>2005-10-31 13:34:10 -0500
commit6ede2463c8d7ea949f8e7ef35243490c415ddc2f (patch)
tree161ec1e8ec68dfd48b80706a08f253bb48e9c3cf
parent581c1b14394aee60aff46ea67d05483261ed6527 (diff)
[BRIDGE]: Use ether_compare
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>
-rw-r--r--net/bridge/br_fdb.c12
-rw-r--r--net/bridge/br_input.c2
-rw-r--r--net/bridge/br_stp_if.c9
3 files changed, 12 insertions, 11 deletions
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index 24396b914d11..1f08a59b51ea 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -86,8 +86,8 @@ void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr)
86 struct net_bridge_port *op; 86 struct net_bridge_port *op;
87 list_for_each_entry(op, &br->port_list, list) { 87 list_for_each_entry(op, &br->port_list, list) {
88 if (op != p && 88 if (op != p &&
89 !memcmp(op->dev->dev_addr, 89 !compare_ether_addr(op->dev->dev_addr,
90 f->addr.addr, ETH_ALEN)) { 90 f->addr.addr)) {
91 f->dst = op; 91 f->dst = op;
92 goto insert; 92 goto insert;
93 } 93 }
@@ -151,8 +151,8 @@ void br_fdb_delete_by_port(struct net_bridge *br, struct net_bridge_port *p)
151 struct net_bridge_port *op; 151 struct net_bridge_port *op;
152 list_for_each_entry(op, &br->port_list, list) { 152 list_for_each_entry(op, &br->port_list, list) {
153 if (op != p && 153 if (op != p &&
154 !memcmp(op->dev->dev_addr, 154 !compare_ether_addr(op->dev->dev_addr,
155 f->addr.addr, ETH_ALEN)) { 155 f->addr.addr)) {
156 f->dst = op; 156 f->dst = op;
157 goto skip_delete; 157 goto skip_delete;
158 } 158 }
@@ -174,7 +174,7 @@ struct net_bridge_fdb_entry *__br_fdb_get(struct net_bridge *br,
174 struct net_bridge_fdb_entry *fdb; 174 struct net_bridge_fdb_entry *fdb;
175 175
176 hlist_for_each_entry_rcu(fdb, h, &br->hash[br_mac_hash(addr)], hlist) { 176 hlist_for_each_entry_rcu(fdb, h, &br->hash[br_mac_hash(addr)], hlist) {
177 if (!memcmp(fdb->addr.addr, addr, ETH_ALEN)) { 177 if (!compare_ether_addr(fdb->addr.addr, addr)) {
178 if (unlikely(has_expired(br, fdb))) 178 if (unlikely(has_expired(br, fdb)))
179 break; 179 break;
180 return fdb; 180 return fdb;
@@ -264,7 +264,7 @@ static inline struct net_bridge_fdb_entry *fdb_find(struct hlist_head *head,
264 struct net_bridge_fdb_entry *fdb; 264 struct net_bridge_fdb_entry *fdb;
265 265
266 hlist_for_each_entry_rcu(fdb, h, head, hlist) { 266 hlist_for_each_entry_rcu(fdb, h, head, hlist) {
267 if (!memcmp(fdb->addr.addr, addr, ETH_ALEN)) 267 if (!compare_ether_addr(fdb->addr.addr, addr))
268 return fdb; 268 return fdb;
269 } 269 }
270 return NULL; 270 return NULL;
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 9a45e6279c57..b88220a64cd8 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -128,7 +128,7 @@ int br_handle_frame(struct net_bridge_port *p, struct sk_buff **pskb)
128 dest = eth_hdr(skb)->h_dest; 128 dest = eth_hdr(skb)->h_dest;
129 } 129 }
130 130
131 if (!memcmp(p->br->dev->dev_addr, dest, ETH_ALEN)) 131 if (!compare_ether_addr(p->br->dev->dev_addr, dest))
132 skb->pkt_type = PACKET_HOST; 132 skb->pkt_type = PACKET_HOST;
133 133
134 NF_HOOK(PF_BRIDGE, NF_BR_PRE_ROUTING, skb, skb->dev, NULL, 134 NF_HOOK(PF_BRIDGE, NF_BR_PRE_ROUTING, skb, skb->dev, NULL,
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index 0da11ff05fa3..ac09b6a23523 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -15,6 +15,7 @@
15 15
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/smp_lock.h> 17#include <linux/smp_lock.h>
18#include <linux/etherdevice.h>
18 19
19#include "br_private.h" 20#include "br_private.h"
20#include "br_private_stp.h" 21#include "br_private_stp.h"
@@ -133,10 +134,10 @@ static void br_stp_change_bridge_id(struct net_bridge *br,
133 memcpy(br->dev->dev_addr, addr, ETH_ALEN); 134 memcpy(br->dev->dev_addr, addr, ETH_ALEN);
134 135
135 list_for_each_entry(p, &br->port_list, list) { 136 list_for_each_entry(p, &br->port_list, list) {
136 if (!memcmp(p->designated_bridge.addr, oldaddr, ETH_ALEN)) 137 if (!compare_ether_addr(p->designated_bridge.addr, oldaddr))
137 memcpy(p->designated_bridge.addr, addr, ETH_ALEN); 138 memcpy(p->designated_bridge.addr, addr, ETH_ALEN);
138 139
139 if (!memcmp(p->designated_root.addr, oldaddr, ETH_ALEN)) 140 if (!compare_ether_addr(p->designated_root.addr, oldaddr))
140 memcpy(p->designated_root.addr, addr, ETH_ALEN); 141 memcpy(p->designated_root.addr, addr, ETH_ALEN);
141 142
142 } 143 }
@@ -157,12 +158,12 @@ void br_stp_recalculate_bridge_id(struct net_bridge *br)
157 158
158 list_for_each_entry(p, &br->port_list, list) { 159 list_for_each_entry(p, &br->port_list, list) {
159 if (addr == br_mac_zero || 160 if (addr == br_mac_zero ||
160 memcmp(p->dev->dev_addr, addr, ETH_ALEN) < 0) 161 compare_ether_addr(p->dev->dev_addr, addr) < 0)
161 addr = p->dev->dev_addr; 162 addr = p->dev->dev_addr;
162 163
163 } 164 }
164 165
165 if (memcmp(br->bridge_id.addr, addr, ETH_ALEN)) 166 if (compare_ether_addr(br->bridge_id.addr, addr))
166 br_stp_change_bridge_id(br, addr); 167 br_stp_change_bridge_id(br, addr);
167} 168}
168 169