From patchwork Sun Mar 16 17:21:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 3839721 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9D44A9F369 for ; Sun, 16 Mar 2014 17:23:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9EB4F2017D for ; Sun, 16 Mar 2014 17:23:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AABA12018A for ; Sun, 16 Mar 2014 17:23:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755165AbaCPRWW (ORCPT ); Sun, 16 Mar 2014 13:22:22 -0400 Received: from mail-bk0-f54.google.com ([209.85.214.54]:35339 "EHLO mail-bk0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754624AbaCPRVy (ORCPT ); Sun, 16 Mar 2014 13:21:54 -0400 Received: by mail-bk0-f54.google.com with SMTP id 6so335978bkj.27 for ; Sun, 16 Mar 2014 10:21:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dm6x57+juXu1wLnf4xKWhsyN9c6byHx7dkVS7P/+KEE=; b=YymR5i7FsrIjvLGGFEAM5fgjzGxPsnVe0mQO4IJRq2vx0Lv6gOaBp2k6ne7pgZAMNB LZkoMZrqt6bC9wbhGp2FG8Im6Mb+h46whtiJPW8jGWo+fdK/mV0gGP3YmjB4ra7Vh0Pl HZucFKs6c3Sg2vqMq54NTFrDxkOfs9JFk34Hi5AEvd1rg1DoEJo+laXqu+LbCO/DmBVP QpBkTdOFvE96ibwj/VGwR5P7DjZFfKsQRih47JY9KaE2f9RNSvN6F/+8q2FTdGQu/lbM ui3ytA1UMkV2tuhDKHiwanxzahEREXs/OCQYYFB3fL/4uTZgHYj2D+HjiBremVLFYy8W YXIg== X-Received: by 10.204.81.14 with SMTP id v14mr10123823bkk.3.1394990512855; Sun, 16 Mar 2014 10:21:52 -0700 (PDT) Received: from david-tp.localdomain (stgt-5f71837b.pool.mediaWays.net. [95.113.131.123]) by mx.google.com with ESMTPSA id ci7sm11314777bkc.0.2014.03.16.10.21.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 16 Mar 2014 10:21:51 -0700 (PDT) From: David Herrmann To: netdev@vger.kernel.org Cc: "David S. Miller" , Tom Gundersen , Johannes berg , linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, David Herrmann , Johannes Berg Subject: [PATCH v2 2/4] mac80211: set NET_NAME_USER for user-space created ifs Date: Sun, 16 Mar 2014 18:21:28 +0100 Message-Id: <1394990490-1076-3-git-send-email-dh.herrmann@gmail.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1394990490-1076-1-git-send-email-dh.herrmann@gmail.com> References: <1394990490-1076-1-git-send-email-dh.herrmann@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The nl80211 interface allows creating new netdevs from user-space. The name is *always* provided by user-space, so we should set NET_NAME_USER to provide that information via sysfs. But we must not set it for the default wlan%d names as these are kernel-provided names. This allows udev to not rename dynamically created wifi devices (like wifi P2P devices). Cc: Johannes Berg Signed-off-by: David Herrmann Acked-by: Tom Gundersen --- net/mac80211/cfg.c | 2 +- net/mac80211/ieee80211_i.h | 1 + net/mac80211/iface.c | 2 ++ net/mac80211/main.c | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 1acb291..34f10fe 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, NET_NAME_USER, &wdev, type, params); if (err) return ERR_PTR(err); diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 0d1a0f8..96f453a 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1469,6 +1469,7 @@ int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, int ieee80211_iface_init(void); void ieee80211_iface_exit(void); int ieee80211_if_add(struct ieee80211_local *local, const char *name, + unsigned char name_assign_type, struct wireless_dev **new_wdev, enum nl80211_iftype type, struct vif_params *params); int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index b8d331e..fe84853 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -1574,6 +1574,7 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local, } int ieee80211_if_add(struct ieee80211_local *local, const char *name, + unsigned char name_assign_type, struct wireless_dev **new_wdev, enum nl80211_iftype type, struct vif_params *params) { @@ -1617,6 +1618,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, + IEEE80211_ENCRYPT_HEADROOM; ndev->needed_tailroom = IEEE80211_ENCRYPT_TAILROOM; + ndev->name_assign_type = name_assign_type; ret = dev_alloc_name(ndev, ndev->name); if (ret < 0) { free_netdev(ndev); diff --git a/net/mac80211/main.c b/net/mac80211/main.c index b055f6a5..ee32a83 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -1012,7 +1012,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, + result = ieee80211_if_add(local, "wlan%d", NET_NAME_ENUM, NULL, NL80211_IFTYPE_STATION, NULL); if (result) wiphy_warn(local->hw.wiphy,