Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 278511
b: refs/heads/master
c: 4359881
h: refs/heads/master
i:
  278509: e8919e3
  278507: f03ab77
  278503: f71a0f5
  278495: fd9e19e
v: v3
  • Loading branch information
stephen hemminger authored and David S. Miller committed Dec 9, 2011
1 parent d7148e5 commit fd4f37d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 31e8a49c161b00c648e960903512c9cbaee777b1
refs/heads/master: 43598813386f6205edf3c21f1fe97f731ccb4f15
7 changes: 5 additions & 2 deletions trunk/net/bridge/br_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,11 @@ static int br_set_mac_address(struct net_device *dev, void *p)
return -EINVAL;

spin_lock_bh(&br->lock);
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
br_stp_change_bridge_id(br, addr->sa_data);
if (compare_ether_addr(dev->dev_addr, addr->sa_data)) {
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
br_fdb_change_mac_address(br, addr->sa_data);
br_stp_change_bridge_id(br, addr->sa_data);
}
br->flags |= BR_SET_MAC_ADDR;
spin_unlock_bh(&br->lock);

Expand Down
20 changes: 18 additions & 2 deletions trunk/net/bridge/br_fdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,18 @@ void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr)
spin_unlock_bh(&br->hash_lock);
}

void br_fdb_change_mac_address(struct net_bridge *br, const u8 *newaddr)
{
struct net_bridge_fdb_entry *f;

/* If old entry was unassociated with any port, then delete it. */
f = __br_fdb_get(br, br->dev->dev_addr);
if (f && f->is_local && !f->dst)
fdb_delete(br, f);

fdb_insert(br, NULL, newaddr);
}

void br_fdb_cleanup(unsigned long _data)
{
struct net_bridge *br = (struct net_bridge *)_data;
Expand Down Expand Up @@ -250,7 +262,7 @@ int br_fdb_test_addr(struct net_device *dev, unsigned char *addr)
ret = 0;
else {
fdb = __br_fdb_get(port->br, addr);
ret = fdb && fdb->dst->dev != dev &&
ret = fdb && fdb->dst && fdb->dst->dev != dev &&
fdb->dst->state == BR_STATE_FORWARDING;
}
rcu_read_unlock();
Expand Down Expand Up @@ -282,6 +294,10 @@ int br_fdb_fillbuf(struct net_bridge *br, void *buf,
if (has_expired(br, f))
continue;

/* ignore pseudo entry for local MAC address */
if (!f->dst)
continue;

if (skip) {
--skip;
continue;
Expand Down Expand Up @@ -468,7 +484,7 @@ static int fdb_fill_info(struct sk_buff *skb, const struct net_bridge *br,
ndm->ndm_pad2 = 0;
ndm->ndm_flags = 0;
ndm->ndm_type = 0;
ndm->ndm_ifindex = fdb->dst->dev->ifindex;
ndm->ndm_ifindex = fdb->dst ? fdb->dst->dev->ifindex : br->dev->ifindex;
ndm->ndm_state = fdb_to_nud(fdb);

NLA_PUT(skb, NDA_LLADDR, ETH_ALEN, &fdb->addr);
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/bridge/br_forward.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static void __br_forward(const struct net_bridge_port *to, struct sk_buff *skb)
/* called with rcu_read_lock */
void br_deliver(const struct net_bridge_port *to, struct sk_buff *skb)
{
if (should_deliver(to, skb)) {
if (to && should_deliver(to, skb)) {
__br_deliver(to, skb);
return;
}
Expand Down
1 change: 1 addition & 0 deletions trunk/net/bridge/br_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ extern void br_fdb_fini(void);
extern void br_fdb_flush(struct net_bridge *br);
extern void br_fdb_changeaddr(struct net_bridge_port *p,
const unsigned char *newaddr);
extern void br_fdb_change_mac_address(struct net_bridge *br, const u8 *newaddr);
extern void br_fdb_cleanup(unsigned long arg);
extern void br_fdb_delete_by_port(struct net_bridge *br,
const struct net_bridge_port *p, int do_all);
Expand Down

0 comments on commit fd4f37d

Please sign in to comment.