diff options
| -rw-r--r-- | net/mac80211/iface.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index ceef64426a8d..98d20c0f6fed 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
| @@ -159,9 +159,10 @@ static int ieee80211_change_mtu(struct net_device *dev, int new_mtu) | |||
| 159 | return 0; | 159 | return 0; |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | static int ieee80211_verify_mac(struct ieee80211_local *local, u8 *addr) | 162 | static int ieee80211_verify_mac(struct ieee80211_sub_if_data *sdata, u8 *addr) |
| 163 | { | 163 | { |
| 164 | struct ieee80211_sub_if_data *sdata; | 164 | struct ieee80211_local *local = sdata->local; |
| 165 | struct ieee80211_sub_if_data *iter; | ||
| 165 | u64 new, mask, tmp; | 166 | u64 new, mask, tmp; |
| 166 | u8 *m; | 167 | u8 *m; |
| 167 | int ret = 0; | 168 | int ret = 0; |
| @@ -181,11 +182,14 @@ static int ieee80211_verify_mac(struct ieee80211_local *local, u8 *addr) | |||
| 181 | 182 | ||
| 182 | 183 | ||
| 183 | mutex_lock(&local->iflist_mtx); | 184 | mutex_lock(&local->iflist_mtx); |
| 184 | list_for_each_entry(sdata, &local->interfaces, list) { | 185 | list_for_each_entry(iter, &local->interfaces, list) { |
| 185 | if (sdata->vif.type == NL80211_IFTYPE_MONITOR) | 186 | if (iter == sdata) |
| 186 | continue; | 187 | continue; |
| 187 | 188 | ||
| 188 | m = sdata->vif.addr; | 189 | if (iter->vif.type == NL80211_IFTYPE_MONITOR) |
| 190 | continue; | ||
| 191 | |||
| 192 | m = iter->vif.addr; | ||
| 189 | tmp = ((u64)m[0] << 5*8) | ((u64)m[1] << 4*8) | | 193 | tmp = ((u64)m[0] << 5*8) | ((u64)m[1] << 4*8) | |
| 190 | ((u64)m[2] << 3*8) | ((u64)m[3] << 2*8) | | 194 | ((u64)m[2] << 3*8) | ((u64)m[3] << 2*8) | |
| 191 | ((u64)m[4] << 1*8) | ((u64)m[5] << 0*8); | 195 | ((u64)m[4] << 1*8) | ((u64)m[5] << 0*8); |
| @@ -209,7 +213,7 @@ static int ieee80211_change_mac(struct net_device *dev, void *addr) | |||
| 209 | if (ieee80211_sdata_running(sdata)) | 213 | if (ieee80211_sdata_running(sdata)) |
| 210 | return -EBUSY; | 214 | return -EBUSY; |
| 211 | 215 | ||
| 212 | ret = ieee80211_verify_mac(sdata->local, sa->sa_data); | 216 | ret = ieee80211_verify_mac(sdata, sa->sa_data); |
| 213 | if (ret) | 217 | if (ret) |
| 214 | return ret; | 218 | return ret; |
| 215 | 219 | ||
| @@ -1486,7 +1490,17 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local, | |||
| 1486 | break; | 1490 | break; |
| 1487 | } | 1491 | } |
| 1488 | 1492 | ||
| 1493 | /* | ||
| 1494 | * Pick address of existing interface in case user changed | ||
| 1495 | * MAC address manually, default to perm_addr. | ||
| 1496 | */ | ||
| 1489 | m = local->hw.wiphy->perm_addr; | 1497 | m = local->hw.wiphy->perm_addr; |
| 1498 | list_for_each_entry(sdata, &local->interfaces, list) { | ||
| 1499 | if (sdata->vif.type == NL80211_IFTYPE_MONITOR) | ||
| 1500 | continue; | ||
| 1501 | m = sdata->vif.addr; | ||
| 1502 | break; | ||
| 1503 | } | ||
| 1490 | start = ((u64)m[0] << 5*8) | ((u64)m[1] << 4*8) | | 1504 | start = ((u64)m[0] << 5*8) | ((u64)m[1] << 4*8) | |
| 1491 | ((u64)m[2] << 3*8) | ((u64)m[3] << 2*8) | | 1505 | ((u64)m[2] << 3*8) | ((u64)m[3] << 2*8) | |
| 1492 | ((u64)m[4] << 1*8) | ((u64)m[5] << 0*8); | 1506 | ((u64)m[4] << 1*8) | ((u64)m[5] << 0*8); |
