wireless: Support of IFLA_INFO_KIND rtnl attribute
authorVadim Kochan <vadim4j@gmail.com>
Tue, 9 Dec 2014 22:21:06 +0000 (00:21 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 12 Dec 2014 12:48:25 +0000 (13:48 +0100)
It allows to identify the wlan kind of device for the user application,
e.g.:

    # ip -d link

    1: lo: <LOOPBACK,UP,LOWER_UP> 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: <NO-CARRIER,BROADCAST,MULTICAST,UP> 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: <BROADCAST,MULTICAST,UP,LOWER_UP> 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 <vadim4j@gmail.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
[make wireless_link_ops const]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/core.c

index 53dda7728f866dd3e7df234a242668c5dbe04f20..4910758baab11be4a318fd34a626b7d6bb90c9f3 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/sched.h>
 #include <net/genetlink.h>
 #include <net/cfg80211.h>
+#include <net/rtnetlink.h>
 #include "nl80211.h"
 #include "core.h"
 #include "sysfs.h"
@@ -937,6 +938,10 @@ void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
 }
 EXPORT_SYMBOL(cfg80211_stop_iface);
 
+static const struct rtnl_link_ops wireless_link_ops = {
+       .kind = "wlan",
+};
+
 static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
                                         unsigned long state, void *ptr)
 {
@@ -954,6 +959,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
        switch (state) {
        case NETDEV_POST_INIT:
                SET_NETDEV_DEVTYPE(dev, &wiphy_type);
+               dev->rtnl_link_ops = &wireless_link_ops;
                break;
        case NETDEV_REGISTER:
                /*