diff mbox

[RFC/RFT] mac80211: use macaddr vif parameter for P2P_DEVICE creation

Message ID 1359382746-26322-1-git-send-email-arend@broadcom.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Arend van Spriel Jan. 28, 2013, 2:19 p.m. UTC
This patch is a follow-up of:

commit 1c18f1452a772dfe884ed25677bddb3ecaf9c43a
Author: Arend van Spriel <arend@broadcom.com>
Date:   Tue Jan 8 10:17:27 2013 +0100

    nl80211: allow user-space to set address for P2P_DEVICE

The address of the wdev is determined by the macaddr parameter
when it is not a zero ethernet address. Otherwise, the permanent
address as determined by ieee80211_assign_perm_addr() is used.

Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
Hi Johannes,

Here a mac80211 change to take the user-space provided mac address into
account. Not sure if that is sufficient. Tested P2P device vif creation using
iw with mac80211_hwsim:

phy#0
        Unnamed/non-netdev interface
                wdev 0x2
                addr 00:01:02:03:04:05
                type P2P-device
        Interface wlan0
                ifindex 9
                wdev 0x1
                addr 02:00:00:00:00:00
                type managed

Gr. AvS
---
 net/mac80211/iface.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Johannes Berg Jan. 29, 2013, 10:57 a.m. UTC | #1
On Mon, 2013-01-28 at 15:19 +0100, Arend van Spriel wrote:
> This patch is a follow-up of:
> 
> commit 1c18f1452a772dfe884ed25677bddb3ecaf9c43a
> Author: Arend van Spriel <arend@broadcom.com>
> Date:   Tue Jan 8 10:17:27 2013 +0100
> 
>     nl80211: allow user-space to set address for P2P_DEVICE
> 
> The address of the wdev is determined by the macaddr parameter
> when it is not a zero ethernet address. Otherwise, the permanent
> address as determined by ieee80211_assign_perm_addr() is used.
> 
> Signed-off-by: Arend van Spriel <arend@broadcom.com>
> ---
> Hi Johannes,
> 
> Here a mac80211 change to take the user-space provided mac address into
> account. Not sure if that is sufficient. Tested P2P device vif creation using
> iw with mac80211_hwsim:

Looks fine to me, yeah.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 0a36dc6..b9ec91f 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1530,7 +1530,12 @@  int ieee80211_if_add(struct ieee80211_local *local, const char *name,
 
 		sdata->dev = NULL;
 		strlcpy(sdata->name, name, IFNAMSIZ);
-		ieee80211_assign_perm_addr(local, wdev->address, type);
+		/* only use perm address if not provided in params */
+		if (is_zero_ether_addr(params->macaddr))
+			ieee80211_assign_perm_addr(local, wdev->address, type);
+		else
+			memcpy(wdev->address, params->macaddr, ETH_ALEN);
+
 		memcpy(sdata->vif.addr, wdev->address, ETH_ALEN);
 	} else {
 		if (local->hw.queues >= IEEE80211_NUM_ACS)