Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 376656
b: refs/heads/master
c: ac20976
h: refs/heads/master
v: v3
  • Loading branch information
Helmut Schaa authored and Johannes Berg committed May 27, 2013
1 parent 559d041 commit 4552ff6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 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: c8aa22db0112f640ac6631347f850879c621840b
refs/heads/master: ac20976dcaeea3e77e40e9aac8f3799d2a22ea2b
26 changes: 20 additions & 6 deletions trunk/net/mac80211/iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,10 @@ static int ieee80211_change_mtu(struct net_device *dev, int new_mtu)
return 0;
}

static int ieee80211_verify_mac(struct ieee80211_local *local, u8 *addr)
static int ieee80211_verify_mac(struct ieee80211_sub_if_data *sdata, u8 *addr)
{
struct ieee80211_sub_if_data *sdata;
struct ieee80211_local *local = sdata->local;
struct ieee80211_sub_if_data *iter;
u64 new, mask, tmp;
u8 *m;
int ret = 0;
Expand All @@ -181,11 +182,14 @@ static int ieee80211_verify_mac(struct ieee80211_local *local, u8 *addr)


mutex_lock(&local->iflist_mtx);
list_for_each_entry(sdata, &local->interfaces, list) {
if (sdata->vif.type == NL80211_IFTYPE_MONITOR)
list_for_each_entry(iter, &local->interfaces, list) {
if (iter == sdata)
continue;

m = sdata->vif.addr;
if (iter->vif.type == NL80211_IFTYPE_MONITOR)
continue;

m = iter->vif.addr;
tmp = ((u64)m[0] << 5*8) | ((u64)m[1] << 4*8) |
((u64)m[2] << 3*8) | ((u64)m[3] << 2*8) |
((u64)m[4] << 1*8) | ((u64)m[5] << 0*8);
Expand All @@ -209,7 +213,7 @@ static int ieee80211_change_mac(struct net_device *dev, void *addr)
if (ieee80211_sdata_running(sdata))
return -EBUSY;

ret = ieee80211_verify_mac(sdata->local, sa->sa_data);
ret = ieee80211_verify_mac(sdata, sa->sa_data);
if (ret)
return ret;

Expand Down Expand Up @@ -1486,7 +1490,17 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local,
break;
}

/*
* Pick address of existing interface in case user changed
* MAC address manually, default to perm_addr.
*/
m = local->hw.wiphy->perm_addr;
list_for_each_entry(sdata, &local->interfaces, list) {
if (sdata->vif.type == NL80211_IFTYPE_MONITOR)
continue;
m = sdata->vif.addr;
break;
}
start = ((u64)m[0] << 5*8) | ((u64)m[1] << 4*8) |
((u64)m[2] << 3*8) | ((u64)m[3] << 2*8) |
((u64)m[4] << 1*8) | ((u64)m[5] << 0*8);
Expand Down

0 comments on commit 4552ff6

Please sign in to comment.