aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/iface.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-06-19 11:19:44 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-08-20 07:58:23 -0400
commit6d71117a279aa30574a8af6c7348570c292285c2 (patch)
tree89334a1d7bf17383524318179c6aee11d52f55d7 /net/mac80211/iface.c
parentf142c6b906da451ded2c7a8e17b2a0e6fee3e891 (diff)
mac80211: add IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF
Some devices like the current iwlwifi implementation require that the P2P interface address match the P2P Device address (only one P2P interface is supported.) Add the HW flag IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF that allows drivers to request that P2P Interfaces added while a P2P Device is active get the same MAC address by default. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/iface.c')
-rw-r--r--net/mac80211/iface.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 152aeea14c85..59f8adc2aa5f 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1313,7 +1313,6 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local,
1313 local->hw.wiphy->n_addresses <= 1) 1313 local->hw.wiphy->n_addresses <= 1)
1314 return; 1314 return;
1315 1315
1316
1317 mutex_lock(&local->iflist_mtx); 1316 mutex_lock(&local->iflist_mtx);
1318 1317
1319 switch (type) { 1318 switch (type) {
@@ -1331,6 +1330,19 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local,
1331 } 1330 }
1332 /* keep default if no AP interface present */ 1331 /* keep default if no AP interface present */
1333 break; 1332 break;
1333 case NL80211_IFTYPE_P2P_CLIENT:
1334 case NL80211_IFTYPE_P2P_GO:
1335 if (local->hw.flags & IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF) {
1336 list_for_each_entry(sdata, &local->interfaces, list) {
1337 if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE)
1338 continue;
1339 if (!ieee80211_sdata_running(sdata))
1340 continue;
1341 memcpy(perm_addr, sdata->vif.addr, ETH_ALEN);
1342 goto out_unlock;
1343 }
1344 }
1345 /* otherwise fall through */
1334 default: 1346 default:
1335 /* assign a new address if possible -- try n_addresses first */ 1347 /* assign a new address if possible -- try n_addresses first */
1336 for (i = 0; i < local->hw.wiphy->n_addresses; i++) { 1348 for (i = 0; i < local->hw.wiphy->n_addresses; i++) {
@@ -1405,6 +1417,7 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local,
1405 break; 1417 break;
1406 } 1418 }
1407 1419
1420 out_unlock:
1408 mutex_unlock(&local->iflist_mtx); 1421 mutex_unlock(&local->iflist_mtx);
1409} 1422}
1410 1423