From patchwork Sun Dec 7 10:20:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Kochan X-Patchwork-Id: 5451231 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 8FE9B9F30B for ; Sun, 7 Dec 2014 10:30:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A74AD20148 for ; Sun, 7 Dec 2014 10:30:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D539B20145 for ; Sun, 7 Dec 2014 10:30:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753045AbaLGKaP (ORCPT ); Sun, 7 Dec 2014 05:30:15 -0500 Received: from mail-lb0-f178.google.com ([209.85.217.178]:47681 "EHLO mail-lb0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752855AbaLGKaP (ORCPT ); Sun, 7 Dec 2014 05:30:15 -0500 Received: by mail-lb0-f178.google.com with SMTP id f15so2787483lbj.9 for ; Sun, 07 Dec 2014 02:30:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=O6dmKmSuhb4n3NOMtugHfVG+FaMwTUuaM7PkThReqKo=; b=ISsUXDeoum+a/1apj/r9ek1NgetpaJYmLNcI8HDr0aKwQ+aVlHdMBUN4sI9DlPVj8f QfrNqDURtntpgUv97PgE2+iDXLHcNM6JKsHSl5xinRYwn65uFVff67uw8KtawM4Y6IOo 7Tfq5glPlhi0YX1RjrbXdJjhIXIHONcj/lsW8U5VlvXPavo6kzhbmopyWsBfsucSV3td 8aNJcica1H6HaeKd8q07xf5Mp2VuTbUNUN3G6oLtSCXCKSw3B+RT2RNlS5rfmR30bg19 zh4uHLbXyhnW26Yy/lSFFJP3DHYk2y2bvUQbZMr3YoD7Lba+78ETyjX/ZQyQU5V2kA41 JF0Q== X-Received: by 10.112.135.197 with SMTP id pu5mr11149632lbb.22.1417948213478; Sun, 07 Dec 2014 02:30:13 -0800 (PST) Received: from localhost.localdomain (121-43-207-82.ip.ukrtel.net. [82.207.43.121]) by mx.google.com with ESMTPSA id xs6sm9866685lbb.13.2014.12.07.02.30.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 07 Dec 2014 02:30:12 -0800 (PST) From: Vadim Kochan To: linville@tuxdriver.com, johannes@sipsolutions.net, linux-wireless@vger.kernel.org Cc: Vadim Kochan Subject: [PATCH v2] mac80211: Supporting of IFLA_INFO_KIND rtnl attribute Date: Sun, 7 Dec 2014 12:20:27 +0200 Message-Id: <1417947627-2329-1-git-send-email-vadim4j@gmail.com> X-Mailer: git-send-email 2.1.3 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 It allows to identify the wlan kind of device for the user application, e.g.: # ip -d link 1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 promiscuity 0 2: enp0s25: mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000 link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff promiscuity 0 3: wlp3s0: mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000 link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff promiscuity 0 wlan Signed-off-by: Vadim Kochan --- net/mac80211/iface.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 653f5eb..e48372b 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "ieee80211_i.h" #include "sta_info.h" #include "debugfs_netdev.h" @@ -1624,6 +1625,10 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local, mutex_unlock(&local->iflist_mtx); } +static struct rtnl_link_ops wireless_link_ops __read_mostly = { + .kind = "wlan", +}; + int ieee80211_if_add(struct ieee80211_local *local, const char *name, struct wireless_dev **new_wdev, enum nl80211_iftype type, struct vif_params *params) @@ -1684,6 +1689,8 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, memcpy(sdata->vif.addr, ndev->dev_addr, ETH_ALEN); memcpy(sdata->name, ndev->name, IFNAMSIZ); + ndev->rtnl_link_ops = &wireless_link_ops; + sdata->dev = ndev; }