From patchwork Fri Jun 7 13:36:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kici?ski X-Patchwork-Id: 2687011 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 821D0DFB78 for ; Fri, 7 Jun 2013 13:36:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753556Ab3FGNgb (ORCPT ); Fri, 7 Jun 2013 09:36:31 -0400 Received: from mx4.wp.pl ([212.77.101.8]:25241 "EHLO mx4.wp.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753082Ab3FGNgY (ORCPT ); Fri, 7 Jun 2013 09:36:24 -0400 Received: (wp-smtpd smtp.wp.pl 13558 invoked from network); 7 Jun 2013 15:36:22 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wp.pl; s=1024a; t=1370612182; bh=15cDeMioaG9hP1bHcWelhyuXkzAOFTjfPqi3waYeqFg=; h=From:To:Cc:Subject; b=eKk5VEGWqNTE1FIEVYF3FnqWV1IK0fdXF9wYrbHkf6KtDQ5ZBCMq8PrBNs75vlbFh 2JnN2+VlNMRy8gS5dtspEBd3NQkMVHUcTurMETFqr2V/i+JehWHcWfC0CR0MfrHhjW AaoeQE9TDI1VmuGj8aowOBxON4bih8mtjj1bOeZc= Received: from 89-71-197-70.dynamic.chello.pl (HELO localhost.localdomain) (moorray3@[89.71.197.70]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with SMTP for ; 7 Jun 2013 15:36:22 +0200 From: Jakub Kicinski To: linux-wireless@vger.kernel.org Cc: Helmut Schaa , Felix Fietkau , Johannes Berg , nietrywialneprzejscie@gmail.com Subject: [RFC 5/5] mac80211: assign right mac addr to active monitors Date: Fri, 7 Jun 2013 15:36:19 +0200 Message-Id: <1370612179-24385-6-git-send-email-moorray3@wp.pl> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1370612179-24385-1-git-send-email-moorray3@wp.pl> References: <1370612179-24385-1-git-send-email-moorray3@wp.pl> X-WP-AV: skaner antywirusowy poczty Wirtualnej Polski S. A. X-WP-SPAM: NO 0000000 [YYKM] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jakub Kicinski Active monitors should have a valid mac address as they are supposed to be able to ack incoming frames. Signed-off-by: Jakub Kicinski --- net/mac80211/cfg.c | 2 +- net/mac80211/ieee80211_i.h | 2 +- net/mac80211/iface.c | 12 +++++++----- net/mac80211/main.c | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 3062210..123b35f 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -31,7 +31,7 @@ static struct wireless_dev *ieee80211_add_iface(struct wiphy *wiphy, struct ieee80211_sub_if_data *sdata; int err; - err = ieee80211_if_add(local, name, &wdev, type, params); + err = ieee80211_if_add(local, name, &wdev, type, flags, params); if (err) return ERR_PTR(err); diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 923e177..a2fa214 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1345,7 +1345,7 @@ int ieee80211_iface_init(void); void ieee80211_iface_exit(void); int ieee80211_if_add(struct ieee80211_local *local, const char *name, struct wireless_dev **new_wdev, enum nl80211_iftype type, - struct vif_params *params); + u32 *flags, struct vif_params *params); int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, enum nl80211_iftype type); void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata); diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 96bfafa..16fc8283 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -1493,7 +1493,8 @@ static void __ieee80211_assign_perm_addr(struct ieee80211_local *local, } static void ieee80211_assign_perm_addr(struct ieee80211_local *local, - u8 *perm_addr, enum nl80211_iftype type) + u8 *perm_addr, enum nl80211_iftype type, + u32 *flags) { struct ieee80211_sub_if_data *sdata; @@ -1517,7 +1518,8 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local, switch (type) { case NL80211_IFTYPE_MONITOR: - /* doesn't matter */ + if (flags && (*flags & MONITOR_FLAG_ACTIVE)) + __ieee80211_assign_perm_addr(local, perm_addr); break; case NL80211_IFTYPE_WDS: case NL80211_IFTYPE_AP_VLAN: @@ -1563,7 +1565,7 @@ static void ieee80211_cleanup_sdata_stas_wk(struct work_struct *wk) int ieee80211_if_add(struct ieee80211_local *local, const char *name, struct wireless_dev **new_wdev, enum nl80211_iftype type, - struct vif_params *params) + u32 *flags, struct vif_params *params) { struct net_device *ndev = NULL; struct ieee80211_sub_if_data *sdata = NULL; @@ -1583,7 +1585,7 @@ 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); + ieee80211_assign_perm_addr(local, wdev->address, type, flags); memcpy(sdata->vif.addr, wdev->address, ETH_ALEN); } else { if (local->hw.queues >= IEEE80211_NUM_ACS) @@ -1611,7 +1613,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, return ret; } - ieee80211_assign_perm_addr(local, ndev->perm_addr, type); + ieee80211_assign_perm_addr(local, ndev->perm_addr, type, flags); memcpy(ndev->dev_addr, ndev->perm_addr, ETH_ALEN); SET_NETDEV_DEV(ndev, wiphy_dev(local->hw.wiphy)); diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 1998f14..edaca0f 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -968,7 +968,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) /* add one default STA interface if supported */ if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION)) { result = ieee80211_if_add(local, "wlan%d", NULL, - NL80211_IFTYPE_STATION, NULL); + NL80211_IFTYPE_STATION, NULL, NULL); if (result) wiphy_warn(local->hw.wiphy, "Failed to add default virtual iface\n");