提交 6ede2463 编写于 作者: S Stephen Hemminger 提交者: Arnaldo Carvalho de Melo

[BRIDGE]: Use ether_compare

Use compare_ether_addr in bridge code.
Signed-off-by: NStephen Hemminger <shemminger@osdl.org>
Signed-off-by: NArnaldo Carvalho de Melo <acme@mandriva.com>
上级 581c1b14
...@@ -86,8 +86,8 @@ void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr) ...@@ -86,8 +86,8 @@ void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr)
struct net_bridge_port *op; struct net_bridge_port *op;
list_for_each_entry(op, &br->port_list, list) { list_for_each_entry(op, &br->port_list, list) {
if (op != p && if (op != p &&
!memcmp(op->dev->dev_addr, !compare_ether_addr(op->dev->dev_addr,
f->addr.addr, ETH_ALEN)) { f->addr.addr)) {
f->dst = op; f->dst = op;
goto insert; goto insert;
} }
...@@ -151,8 +151,8 @@ void br_fdb_delete_by_port(struct net_bridge *br, struct net_bridge_port *p) ...@@ -151,8 +151,8 @@ void br_fdb_delete_by_port(struct net_bridge *br, struct net_bridge_port *p)
struct net_bridge_port *op; struct net_bridge_port *op;
list_for_each_entry(op, &br->port_list, list) { list_for_each_entry(op, &br->port_list, list) {
if (op != p && if (op != p &&
!memcmp(op->dev->dev_addr, !compare_ether_addr(op->dev->dev_addr,
f->addr.addr, ETH_ALEN)) { f->addr.addr)) {
f->dst = op; f->dst = op;
goto skip_delete; goto skip_delete;
} }
...@@ -174,7 +174,7 @@ struct net_bridge_fdb_entry *__br_fdb_get(struct net_bridge *br, ...@@ -174,7 +174,7 @@ struct net_bridge_fdb_entry *__br_fdb_get(struct net_bridge *br,
struct net_bridge_fdb_entry *fdb; struct net_bridge_fdb_entry *fdb;
hlist_for_each_entry_rcu(fdb, h, &br->hash[br_mac_hash(addr)], hlist) { 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))) if (unlikely(has_expired(br, fdb)))
break; break;
return fdb; return fdb;
...@@ -264,7 +264,7 @@ static inline struct net_bridge_fdb_entry *fdb_find(struct hlist_head *head, ...@@ -264,7 +264,7 @@ static inline struct net_bridge_fdb_entry *fdb_find(struct hlist_head *head,
struct net_bridge_fdb_entry *fdb; struct net_bridge_fdb_entry *fdb;
hlist_for_each_entry_rcu(fdb, h, head, hlist) { 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 fdb;
} }
return NULL; return NULL;
......
...@@ -128,7 +128,7 @@ int br_handle_frame(struct net_bridge_port *p, struct sk_buff **pskb) ...@@ -128,7 +128,7 @@ int br_handle_frame(struct net_bridge_port *p, struct sk_buff **pskb)
dest = eth_hdr(skb)->h_dest; 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; skb->pkt_type = PACKET_HOST;
NF_HOOK(PF_BRIDGE, NF_BR_PRE_ROUTING, skb, skb->dev, NULL, NF_HOOK(PF_BRIDGE, NF_BR_PRE_ROUTING, skb, skb->dev, NULL,
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/etherdevice.h>
#include "br_private.h" #include "br_private.h"
#include "br_private_stp.h" #include "br_private_stp.h"
...@@ -133,10 +134,10 @@ static void br_stp_change_bridge_id(struct net_bridge *br, ...@@ -133,10 +134,10 @@ static void br_stp_change_bridge_id(struct net_bridge *br,
memcpy(br->dev->dev_addr, addr, ETH_ALEN); memcpy(br->dev->dev_addr, addr, ETH_ALEN);
list_for_each_entry(p, &br->port_list, list) { 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); 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); memcpy(p->designated_root.addr, addr, ETH_ALEN);
} }
...@@ -157,12 +158,12 @@ void br_stp_recalculate_bridge_id(struct net_bridge *br) ...@@ -157,12 +158,12 @@ void br_stp_recalculate_bridge_id(struct net_bridge *br)
list_for_each_entry(p, &br->port_list, list) { list_for_each_entry(p, &br->port_list, list) {
if (addr == br_mac_zero || 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; 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); br_stp_change_bridge_id(br, addr);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册