Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 111189
b: refs/heads/master
c: bdbe819
h: refs/heads/master
i:
  111187: 6d27570
v: v3
  • Loading branch information
Luis Carlos Cobo authored and John W. Linville committed Aug 22, 2008
1 parent af32eb5 commit 27090c8
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4eb2ae9a42b77de48ee9fecfaccc66c640313188
refs/heads/master: bdbe819540f3365249095692118dbfeee308140d
38 changes: 38 additions & 0 deletions trunk/net/mac80211/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,15 @@ static int ieee80211_open(struct net_device *dev)
u32 changed = 0;
int res;
bool need_hw_reconfig = 0;
u8 null_addr[ETH_ALEN] = {0};

sdata = IEEE80211_DEV_TO_SUB_IF(dev);

/* fail early if user set an invalid address */
if (compare_ether_addr(dev->dev_addr, null_addr) &&
!is_valid_ether_addr(dev->dev_addr))
return -EADDRNOTAVAIL;

/* we hold the RTNL here so can safely walk the list */
list_for_each_entry(nsdata, &local->interfaces, list) {
struct net_device *ndev = nsdata->dev;
Expand Down Expand Up @@ -270,6 +276,36 @@ static int ieee80211_open(struct net_device *dev)
ieee80211_led_radio(local, local->hw.conf.radio_enabled);
}

/*
* Check all interfaces and copy the hopefully now-present
* MAC address to those that have the special null one.
*/
list_for_each_entry(nsdata, &local->interfaces, list) {
struct net_device *ndev = nsdata->dev;

/*
* No need to check netif_running since we do not allow
* it to start up with this invalid address.
*/
if (compare_ether_addr(null_addr, ndev->dev_addr) == 0)
memcpy(ndev->dev_addr,
local->hw.wiphy->perm_addr,
ETH_ALEN);
}

if (compare_ether_addr(null_addr, local->mdev->dev_addr) == 0)
memcpy(local->mdev->dev_addr, local->hw.wiphy->perm_addr,
ETH_ALEN);

/*
* Validate the MAC address for this device.
*/
if (!is_valid_ether_addr(dev->dev_addr)) {
if (!local->open_count && local->ops->stop)
local->ops->stop(local_to_hw(local));
return -EADDRNOTAVAIL;
}

switch (sdata->vif.type) {
case IEEE80211_IF_TYPE_VLAN:
/* no need to tell driver */
Expand Down Expand Up @@ -975,6 +1011,8 @@ void ieee80211_if_setup(struct net_device *dev)
dev->open = ieee80211_open;
dev->stop = ieee80211_stop;
dev->destructor = free_netdev;
/* we will validate the address ourselves in ->open */
dev->validate_addr = NULL;
}

/* everything else */
Expand Down

0 comments on commit 27090c8

Please sign in to comment.