From patchwork Mon Jan 28 14:19:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arend van Spriel X-Patchwork-Id: 2056361 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id E7074E00C6 for ; Mon, 28 Jan 2013 14:19:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756805Ab3A1OTQ (ORCPT ); Mon, 28 Jan 2013 09:19:16 -0500 Received: from mms3.broadcom.com ([216.31.210.19]:1532 "EHLO mms3.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756756Ab3A1OTQ (ORCPT ); Mon, 28 Jan 2013 09:19:16 -0500 Received: from [10.9.208.57] by mms3.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.5)); Mon, 28 Jan 2013 06:13:44 -0800 X-Server-Uuid: B86B6450-0931-4310-942E-F00ED04CA7AF Received: from IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) by IRVEXCHCAS08.corp.ad.broadcom.com (10.9.208.57) with Microsoft SMTP Server (TLS) id 14.1.355.2; Mon, 28 Jan 2013 06:19:08 -0800 Received: from mail-sj1-12.sj.broadcom.com (10.10.10.20) by IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) with Microsoft SMTP Server id 14.1.355.2; Mon, 28 Jan 2013 06:19:08 -0800 Received: from linux-e6410-1 (unknown [10.176.68.36]) by mail-sj1-12.sj.broadcom.com (Postfix) with ESMTP id 20899207CD; Mon, 28 Jan 2013 06:19:08 -0800 (PST) Received: from arend by linux-e6410-1 with local (Exim 4.80) ( envelope-from ) id 1TzpYB-0006r7-40; Mon, 28 Jan 2013 15:19:07 +0100 From: "Arend van Spriel" To: "Johannes Berg" cc: "Linux Wireless List" , "Arend van Spriel" Subject: [RFC/RFT] mac80211: use macaddr vif parameter for P2P_DEVICE creation Date: Mon, 28 Jan 2013 15:19:06 +0100 Message-ID: <1359382746-26322-1-git-send-email-arend@broadcom.com> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 X-WSS-ID: 7D1858123QC1317392-01-01 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This patch is a follow-up of: commit 1c18f1452a772dfe884ed25677bddb3ecaf9c43a Author: Arend van Spriel 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 --- 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(-) 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)