diff options
Diffstat (limited to 'net/mac80211/iface.c')
-rw-r--r-- | net/mac80211/iface.c | 190 |
1 files changed, 149 insertions, 41 deletions
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index b8295cbd7e8f..e08fa8eda1b3 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -10,17 +10,20 @@ | |||
10 | * it under the terms of the GNU General Public License version 2 as | 10 | * it under the terms of the GNU General Public License version 2 as |
11 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
12 | */ | 12 | */ |
13 | #include <linux/slab.h> | ||
13 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
14 | #include <linux/if_arp.h> | 15 | #include <linux/if_arp.h> |
15 | #include <linux/netdevice.h> | 16 | #include <linux/netdevice.h> |
16 | #include <linux/rtnetlink.h> | 17 | #include <linux/rtnetlink.h> |
17 | #include <net/mac80211.h> | 18 | #include <net/mac80211.h> |
19 | #include <net/ieee80211_radiotap.h> | ||
18 | #include "ieee80211_i.h" | 20 | #include "ieee80211_i.h" |
19 | #include "sta_info.h" | 21 | #include "sta_info.h" |
20 | #include "debugfs_netdev.h" | 22 | #include "debugfs_netdev.h" |
21 | #include "mesh.h" | 23 | #include "mesh.h" |
22 | #include "led.h" | 24 | #include "led.h" |
23 | #include "driver-ops.h" | 25 | #include "driver-ops.h" |
26 | #include "wme.h" | ||
24 | 27 | ||
25 | /** | 28 | /** |
26 | * DOC: Interface list locking | 29 | * DOC: Interface list locking |
@@ -60,6 +63,23 @@ static int ieee80211_change_mtu(struct net_device *dev, int new_mtu) | |||
60 | return 0; | 63 | return 0; |
61 | } | 64 | } |
62 | 65 | ||
66 | static int ieee80211_change_mac(struct net_device *dev, void *addr) | ||
67 | { | ||
68 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
69 | struct sockaddr *sa = addr; | ||
70 | int ret; | ||
71 | |||
72 | if (ieee80211_sdata_running(sdata)) | ||
73 | return -EBUSY; | ||
74 | |||
75 | ret = eth_mac_addr(dev, sa); | ||
76 | |||
77 | if (ret == 0) | ||
78 | memcpy(sdata->vif.addr, sa->sa_data, ETH_ALEN); | ||
79 | |||
80 | return ret; | ||
81 | } | ||
82 | |||
63 | static inline int identical_mac_addr_allowed(int type1, int type2) | 83 | static inline int identical_mac_addr_allowed(int type1, int type2) |
64 | { | 84 | { |
65 | return type1 == NL80211_IFTYPE_MONITOR || | 85 | return type1 == NL80211_IFTYPE_MONITOR || |
@@ -80,7 +100,6 @@ static int ieee80211_open(struct net_device *dev) | |||
80 | struct ieee80211_sub_if_data *nsdata; | 100 | struct ieee80211_sub_if_data *nsdata; |
81 | struct ieee80211_local *local = sdata->local; | 101 | struct ieee80211_local *local = sdata->local; |
82 | struct sta_info *sta; | 102 | struct sta_info *sta; |
83 | struct ieee80211_if_init_conf conf; | ||
84 | u32 changed = 0; | 103 | u32 changed = 0; |
85 | int res; | 104 | int res; |
86 | u32 hw_reconf_flags = 0; | 105 | u32 hw_reconf_flags = 0; |
@@ -95,7 +114,7 @@ static int ieee80211_open(struct net_device *dev) | |||
95 | list_for_each_entry(nsdata, &local->interfaces, list) { | 114 | list_for_each_entry(nsdata, &local->interfaces, list) { |
96 | struct net_device *ndev = nsdata->dev; | 115 | struct net_device *ndev = nsdata->dev; |
97 | 116 | ||
98 | if (ndev != dev && netif_running(ndev)) { | 117 | if (ndev != dev && ieee80211_sdata_running(nsdata)) { |
99 | /* | 118 | /* |
100 | * Allow only a single IBSS interface to be up at any | 119 | * Allow only a single IBSS interface to be up at any |
101 | * time. This is restricted because beacon distribution | 120 | * time. This is restricted because beacon distribution |
@@ -181,13 +200,15 @@ static int ieee80211_open(struct net_device *dev) | |||
181 | struct net_device *ndev = nsdata->dev; | 200 | struct net_device *ndev = nsdata->dev; |
182 | 201 | ||
183 | /* | 202 | /* |
184 | * No need to check netif_running since we do not allow | 203 | * No need to check running since we do not allow |
185 | * it to start up with this invalid address. | 204 | * it to start up with this invalid address. |
186 | */ | 205 | */ |
187 | if (compare_ether_addr(null_addr, ndev->dev_addr) == 0) | 206 | if (compare_ether_addr(null_addr, ndev->dev_addr) == 0) { |
188 | memcpy(ndev->dev_addr, | 207 | memcpy(ndev->dev_addr, |
189 | local->hw.wiphy->perm_addr, | 208 | local->hw.wiphy->perm_addr, |
190 | ETH_ALEN); | 209 | ETH_ALEN); |
210 | memcpy(ndev->perm_addr, ndev->dev_addr, ETH_ALEN); | ||
211 | } | ||
191 | } | 212 | } |
192 | 213 | ||
193 | /* | 214 | /* |
@@ -212,8 +233,8 @@ static int ieee80211_open(struct net_device *dev) | |||
212 | /* must be before the call to ieee80211_configure_filter */ | 233 | /* must be before the call to ieee80211_configure_filter */ |
213 | local->monitors++; | 234 | local->monitors++; |
214 | if (local->monitors == 1) { | 235 | if (local->monitors == 1) { |
215 | local->hw.conf.flags |= IEEE80211_CONF_RADIOTAP; | 236 | local->hw.conf.flags |= IEEE80211_CONF_MONITOR; |
216 | hw_reconf_flags |= IEEE80211_CONF_CHANGE_RADIOTAP; | 237 | hw_reconf_flags |= IEEE80211_CONF_CHANGE_MONITOR; |
217 | } | 238 | } |
218 | 239 | ||
219 | if (sdata->u.mntr_flags & MONITOR_FLAG_FCSFAIL) | 240 | if (sdata->u.mntr_flags & MONITOR_FLAG_FCSFAIL) |
@@ -230,10 +251,7 @@ static int ieee80211_open(struct net_device *dev) | |||
230 | ieee80211_configure_filter(local); | 251 | ieee80211_configure_filter(local); |
231 | break; | 252 | break; |
232 | default: | 253 | default: |
233 | conf.vif = &sdata->vif; | 254 | res = drv_add_interface(local, &sdata->vif); |
234 | conf.type = sdata->vif.type; | ||
235 | conf.mac_addr = dev->dev_addr; | ||
236 | res = drv_add_interface(local, &conf); | ||
237 | if (res) | 255 | if (res) |
238 | goto err_stop; | 256 | goto err_stop; |
239 | 257 | ||
@@ -316,7 +334,7 @@ static int ieee80211_open(struct net_device *dev) | |||
316 | 334 | ||
317 | return 0; | 335 | return 0; |
318 | err_del_interface: | 336 | err_del_interface: |
319 | drv_remove_interface(local, &conf); | 337 | drv_remove_interface(local, &sdata->vif); |
320 | err_stop: | 338 | err_stop: |
321 | if (!local->open_count) | 339 | if (!local->open_count) |
322 | drv_stop(local); | 340 | drv_stop(local); |
@@ -331,7 +349,6 @@ static int ieee80211_stop(struct net_device *dev) | |||
331 | { | 349 | { |
332 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 350 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
333 | struct ieee80211_local *local = sdata->local; | 351 | struct ieee80211_local *local = sdata->local; |
334 | struct ieee80211_if_init_conf conf; | ||
335 | struct sta_info *sta; | 352 | struct sta_info *sta; |
336 | unsigned long flags; | 353 | unsigned long flags; |
337 | struct sk_buff *skb, *tmp; | 354 | struct sk_buff *skb, *tmp; |
@@ -344,6 +361,11 @@ static int ieee80211_stop(struct net_device *dev) | |||
344 | netif_tx_stop_all_queues(dev); | 361 | netif_tx_stop_all_queues(dev); |
345 | 362 | ||
346 | /* | 363 | /* |
364 | * Purge work for this interface. | ||
365 | */ | ||
366 | ieee80211_work_purge(sdata); | ||
367 | |||
368 | /* | ||
347 | * Now delete all active aggregation sessions. | 369 | * Now delete all active aggregation sessions. |
348 | */ | 370 | */ |
349 | rcu_read_lock(); | 371 | rcu_read_lock(); |
@@ -433,8 +455,8 @@ static int ieee80211_stop(struct net_device *dev) | |||
433 | 455 | ||
434 | local->monitors--; | 456 | local->monitors--; |
435 | if (local->monitors == 0) { | 457 | if (local->monitors == 0) { |
436 | local->hw.conf.flags &= ~IEEE80211_CONF_RADIOTAP; | 458 | local->hw.conf.flags &= ~IEEE80211_CONF_MONITOR; |
437 | hw_reconf_flags |= IEEE80211_CONF_CHANGE_RADIOTAP; | 459 | hw_reconf_flags |= IEEE80211_CONF_CHANGE_MONITOR; |
438 | } | 460 | } |
439 | 461 | ||
440 | if (sdata->u.mntr_flags & MONITOR_FLAG_FCSFAIL) | 462 | if (sdata->u.mntr_flags & MONITOR_FLAG_FCSFAIL) |
@@ -510,12 +532,9 @@ static int ieee80211_stop(struct net_device *dev) | |||
510 | BSS_CHANGED_BEACON_ENABLED); | 532 | BSS_CHANGED_BEACON_ENABLED); |
511 | } | 533 | } |
512 | 534 | ||
513 | conf.vif = &sdata->vif; | ||
514 | conf.type = sdata->vif.type; | ||
515 | conf.mac_addr = dev->dev_addr; | ||
516 | /* disable all keys for as long as this netdev is down */ | 535 | /* disable all keys for as long as this netdev is down */ |
517 | ieee80211_disable_keys(sdata); | 536 | ieee80211_disable_keys(sdata); |
518 | drv_remove_interface(local, &conf); | 537 | drv_remove_interface(local, &sdata->vif); |
519 | } | 538 | } |
520 | 539 | ||
521 | sdata->bss = NULL; | 540 | sdata->bss = NULL; |
@@ -642,6 +661,12 @@ static void ieee80211_teardown_sdata(struct net_device *dev) | |||
642 | WARN_ON(flushed); | 661 | WARN_ON(flushed); |
643 | } | 662 | } |
644 | 663 | ||
664 | static u16 ieee80211_netdev_select_queue(struct net_device *dev, | ||
665 | struct sk_buff *skb) | ||
666 | { | ||
667 | return ieee80211_select_queue(IEEE80211_DEV_TO_SUB_IF(dev), skb); | ||
668 | } | ||
669 | |||
645 | static const struct net_device_ops ieee80211_dataif_ops = { | 670 | static const struct net_device_ops ieee80211_dataif_ops = { |
646 | .ndo_open = ieee80211_open, | 671 | .ndo_open = ieee80211_open, |
647 | .ndo_stop = ieee80211_stop, | 672 | .ndo_stop = ieee80211_stop, |
@@ -649,9 +674,43 @@ static const struct net_device_ops ieee80211_dataif_ops = { | |||
649 | .ndo_start_xmit = ieee80211_subif_start_xmit, | 674 | .ndo_start_xmit = ieee80211_subif_start_xmit, |
650 | .ndo_set_multicast_list = ieee80211_set_multicast_list, | 675 | .ndo_set_multicast_list = ieee80211_set_multicast_list, |
651 | .ndo_change_mtu = ieee80211_change_mtu, | 676 | .ndo_change_mtu = ieee80211_change_mtu, |
652 | .ndo_set_mac_address = eth_mac_addr, | 677 | .ndo_set_mac_address = ieee80211_change_mac, |
678 | .ndo_select_queue = ieee80211_netdev_select_queue, | ||
653 | }; | 679 | }; |
654 | 680 | ||
681 | static u16 ieee80211_monitor_select_queue(struct net_device *dev, | ||
682 | struct sk_buff *skb) | ||
683 | { | ||
684 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
685 | struct ieee80211_local *local = sdata->local; | ||
686 | struct ieee80211_hdr *hdr; | ||
687 | struct ieee80211_radiotap_header *rtap = (void *)skb->data; | ||
688 | u8 *p; | ||
689 | |||
690 | if (local->hw.queues < 4) | ||
691 | return 0; | ||
692 | |||
693 | if (skb->len < 4 || | ||
694 | skb->len < le16_to_cpu(rtap->it_len) + 2 /* frame control */) | ||
695 | return 0; /* doesn't matter, frame will be dropped */ | ||
696 | |||
697 | hdr = (void *)((u8 *)skb->data + le16_to_cpu(rtap->it_len)); | ||
698 | |||
699 | if (!ieee80211_is_data(hdr->frame_control)) { | ||
700 | skb->priority = 7; | ||
701 | return ieee802_1d_to_ac[skb->priority]; | ||
702 | } | ||
703 | if (!ieee80211_is_data_qos(hdr->frame_control)) { | ||
704 | skb->priority = 0; | ||
705 | return ieee802_1d_to_ac[skb->priority]; | ||
706 | } | ||
707 | |||
708 | p = ieee80211_get_qos_ctl(hdr); | ||
709 | skb->priority = *p & IEEE80211_QOS_CTL_TAG1D_MASK; | ||
710 | |||
711 | return ieee80211_downgrade_queue(local, skb); | ||
712 | } | ||
713 | |||
655 | static const struct net_device_ops ieee80211_monitorif_ops = { | 714 | static const struct net_device_ops ieee80211_monitorif_ops = { |
656 | .ndo_open = ieee80211_open, | 715 | .ndo_open = ieee80211_open, |
657 | .ndo_stop = ieee80211_stop, | 716 | .ndo_stop = ieee80211_stop, |
@@ -660,6 +719,7 @@ static const struct net_device_ops ieee80211_monitorif_ops = { | |||
660 | .ndo_set_multicast_list = ieee80211_set_multicast_list, | 719 | .ndo_set_multicast_list = ieee80211_set_multicast_list, |
661 | .ndo_change_mtu = ieee80211_change_mtu, | 720 | .ndo_change_mtu = ieee80211_change_mtu, |
662 | .ndo_set_mac_address = eth_mac_addr, | 721 | .ndo_set_mac_address = eth_mac_addr, |
722 | .ndo_select_queue = ieee80211_monitor_select_queue, | ||
663 | }; | 723 | }; |
664 | 724 | ||
665 | static void ieee80211_if_setup(struct net_device *dev) | 725 | static void ieee80211_if_setup(struct net_device *dev) |
@@ -738,7 +798,7 @@ int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, | |||
738 | * and goes into the requested mode. | 798 | * and goes into the requested mode. |
739 | */ | 799 | */ |
740 | 800 | ||
741 | if (netif_running(sdata->dev)) | 801 | if (ieee80211_sdata_running(sdata)) |
742 | return -EBUSY; | 802 | return -EBUSY; |
743 | 803 | ||
744 | /* Purge and reset type-dependent state. */ | 804 | /* Purge and reset type-dependent state. */ |
@@ -750,14 +810,12 @@ int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, | |||
750 | ieee80211_mandatory_rates(sdata->local, | 810 | ieee80211_mandatory_rates(sdata->local, |
751 | sdata->local->hw.conf.channel->band); | 811 | sdata->local->hw.conf.channel->band); |
752 | sdata->drop_unencrypted = 0; | 812 | sdata->drop_unencrypted = 0; |
813 | if (type == NL80211_IFTYPE_STATION) | ||
814 | sdata->u.mgd.use_4addr = false; | ||
753 | 815 | ||
754 | return 0; | 816 | return 0; |
755 | } | 817 | } |
756 | 818 | ||
757 | static struct device_type wiphy_type = { | ||
758 | .name = "wlan", | ||
759 | }; | ||
760 | |||
761 | int ieee80211_if_add(struct ieee80211_local *local, const char *name, | 819 | int ieee80211_if_add(struct ieee80211_local *local, const char *name, |
762 | struct net_device **new_dev, enum nl80211_iftype type, | 820 | struct net_device **new_dev, enum nl80211_iftype type, |
763 | struct vif_params *params) | 821 | struct vif_params *params) |
@@ -768,8 +826,8 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, | |||
768 | 826 | ||
769 | ASSERT_RTNL(); | 827 | ASSERT_RTNL(); |
770 | 828 | ||
771 | ndev = alloc_netdev(sizeof(*sdata) + local->hw.vif_data_size, | 829 | ndev = alloc_netdev_mq(sizeof(*sdata) + local->hw.vif_data_size, |
772 | name, ieee80211_if_setup); | 830 | name, ieee80211_if_setup, local->hw.queues); |
773 | if (!ndev) | 831 | if (!ndev) |
774 | return -ENOMEM; | 832 | return -ENOMEM; |
775 | dev_net_set(ndev, wiphy_net(local->hw.wiphy)); | 833 | dev_net_set(ndev, wiphy_net(local->hw.wiphy)); |
@@ -788,12 +846,14 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, | |||
788 | goto fail; | 846 | goto fail; |
789 | 847 | ||
790 | memcpy(ndev->dev_addr, local->hw.wiphy->perm_addr, ETH_ALEN); | 848 | memcpy(ndev->dev_addr, local->hw.wiphy->perm_addr, ETH_ALEN); |
849 | memcpy(ndev->perm_addr, ndev->dev_addr, ETH_ALEN); | ||
791 | SET_NETDEV_DEV(ndev, wiphy_dev(local->hw.wiphy)); | 850 | SET_NETDEV_DEV(ndev, wiphy_dev(local->hw.wiphy)); |
792 | SET_NETDEV_DEVTYPE(ndev, &wiphy_type); | ||
793 | 851 | ||
794 | /* don't use IEEE80211_DEV_TO_SUB_IF because it checks too much */ | 852 | /* don't use IEEE80211_DEV_TO_SUB_IF because it checks too much */ |
795 | sdata = netdev_priv(ndev); | 853 | sdata = netdev_priv(ndev); |
796 | ndev->ieee80211_ptr = &sdata->wdev; | 854 | ndev->ieee80211_ptr = &sdata->wdev; |
855 | memcpy(sdata->vif.addr, ndev->dev_addr, ETH_ALEN); | ||
856 | memcpy(sdata->name, ndev->name, IFNAMSIZ); | ||
797 | 857 | ||
798 | /* initialise type-independent data */ | 858 | /* initialise type-independent data */ |
799 | sdata->wdev.wiphy = local->hw.wiphy; | 859 | sdata->wdev.wiphy = local->hw.wiphy; |
@@ -805,12 +865,22 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, | |||
805 | 865 | ||
806 | INIT_LIST_HEAD(&sdata->key_list); | 866 | INIT_LIST_HEAD(&sdata->key_list); |
807 | 867 | ||
808 | sdata->force_unicast_rateidx = -1; | 868 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) { |
809 | sdata->max_ratectrl_rateidx = -1; | 869 | struct ieee80211_supported_band *sband; |
870 | sband = local->hw.wiphy->bands[i]; | ||
871 | sdata->rc_rateidx_mask[i] = | ||
872 | sband ? (1 << sband->n_bitrates) - 1 : 0; | ||
873 | } | ||
810 | 874 | ||
811 | /* setup type-dependent data */ | 875 | /* setup type-dependent data */ |
812 | ieee80211_setup_sdata(sdata, type); | 876 | ieee80211_setup_sdata(sdata, type); |
813 | 877 | ||
878 | if (params) { | ||
879 | ndev->ieee80211_ptr->use_4addr = params->use_4addr; | ||
880 | if (type == NL80211_IFTYPE_STATION) | ||
881 | sdata->u.mgd.use_4addr = params->use_4addr; | ||
882 | } | ||
883 | |||
814 | ret = register_netdevice(ndev); | 884 | ret = register_netdevice(ndev); |
815 | if (ret) | 885 | if (ret) |
816 | goto fail; | 886 | goto fail; |
@@ -854,22 +924,18 @@ void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata) | |||
854 | void ieee80211_remove_interfaces(struct ieee80211_local *local) | 924 | void ieee80211_remove_interfaces(struct ieee80211_local *local) |
855 | { | 925 | { |
856 | struct ieee80211_sub_if_data *sdata, *tmp; | 926 | struct ieee80211_sub_if_data *sdata, *tmp; |
927 | LIST_HEAD(unreg_list); | ||
857 | 928 | ||
858 | ASSERT_RTNL(); | 929 | ASSERT_RTNL(); |
859 | 930 | ||
931 | mutex_lock(&local->iflist_mtx); | ||
860 | list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) { | 932 | list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) { |
861 | /* | ||
862 | * we cannot hold the iflist_mtx across unregister_netdevice, | ||
863 | * but we only need to hold it for list modifications to lock | ||
864 | * out readers since we're under the RTNL here as all other | ||
865 | * writers. | ||
866 | */ | ||
867 | mutex_lock(&local->iflist_mtx); | ||
868 | list_del(&sdata->list); | 933 | list_del(&sdata->list); |
869 | mutex_unlock(&local->iflist_mtx); | ||
870 | 934 | ||
871 | unregister_netdevice(sdata->dev); | 935 | unregister_netdevice_queue(sdata->dev, &unreg_list); |
872 | } | 936 | } |
937 | mutex_unlock(&local->iflist_mtx); | ||
938 | unregister_netdevice_many(&unreg_list); | ||
873 | } | 939 | } |
874 | 940 | ||
875 | static u32 ieee80211_idle_off(struct ieee80211_local *local, | 941 | static u32 ieee80211_idle_off(struct ieee80211_local *local, |
@@ -897,6 +963,8 @@ static u32 ieee80211_idle_on(struct ieee80211_local *local) | |||
897 | wiphy_name(local->hw.wiphy)); | 963 | wiphy_name(local->hw.wiphy)); |
898 | #endif | 964 | #endif |
899 | 965 | ||
966 | drv_flush(local, false); | ||
967 | |||
900 | local->hw.conf.flags |= IEEE80211_CONF_IDLE; | 968 | local->hw.conf.flags |= IEEE80211_CONF_IDLE; |
901 | return IEEE80211_CONF_CHANGE_IDLE; | 969 | return IEEE80211_CONF_CHANGE_IDLE; |
902 | } | 970 | } |
@@ -906,16 +974,18 @@ u32 __ieee80211_recalc_idle(struct ieee80211_local *local) | |||
906 | struct ieee80211_sub_if_data *sdata; | 974 | struct ieee80211_sub_if_data *sdata; |
907 | int count = 0; | 975 | int count = 0; |
908 | 976 | ||
977 | if (!list_empty(&local->work_list)) | ||
978 | return ieee80211_idle_off(local, "working"); | ||
979 | |||
909 | if (local->scanning) | 980 | if (local->scanning) |
910 | return ieee80211_idle_off(local, "scanning"); | 981 | return ieee80211_idle_off(local, "scanning"); |
911 | 982 | ||
912 | list_for_each_entry(sdata, &local->interfaces, list) { | 983 | list_for_each_entry(sdata, &local->interfaces, list) { |
913 | if (!netif_running(sdata->dev)) | 984 | if (!ieee80211_sdata_running(sdata)) |
914 | continue; | 985 | continue; |
915 | /* do not count disabled managed interfaces */ | 986 | /* do not count disabled managed interfaces */ |
916 | if (sdata->vif.type == NL80211_IFTYPE_STATION && | 987 | if (sdata->vif.type == NL80211_IFTYPE_STATION && |
917 | !sdata->u.mgd.associated && | 988 | !sdata->u.mgd.associated) |
918 | list_empty(&sdata->u.mgd.work_list)) | ||
919 | continue; | 989 | continue; |
920 | /* do not count unused IBSS interfaces */ | 990 | /* do not count unused IBSS interfaces */ |
921 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC && | 991 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC && |
@@ -943,3 +1013,41 @@ void ieee80211_recalc_idle(struct ieee80211_local *local) | |||
943 | if (chg) | 1013 | if (chg) |
944 | ieee80211_hw_config(local, chg); | 1014 | ieee80211_hw_config(local, chg); |
945 | } | 1015 | } |
1016 | |||
1017 | static int netdev_notify(struct notifier_block *nb, | ||
1018 | unsigned long state, | ||
1019 | void *ndev) | ||
1020 | { | ||
1021 | struct net_device *dev = ndev; | ||
1022 | struct ieee80211_sub_if_data *sdata; | ||
1023 | |||
1024 | if (state != NETDEV_CHANGENAME) | ||
1025 | return 0; | ||
1026 | |||
1027 | if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy) | ||
1028 | return 0; | ||
1029 | |||
1030 | if (dev->ieee80211_ptr->wiphy->privid != mac80211_wiphy_privid) | ||
1031 | return 0; | ||
1032 | |||
1033 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1034 | |||
1035 | memcpy(sdata->name, dev->name, IFNAMSIZ); | ||
1036 | |||
1037 | ieee80211_debugfs_rename_netdev(sdata); | ||
1038 | return 0; | ||
1039 | } | ||
1040 | |||
1041 | static struct notifier_block mac80211_netdev_notifier = { | ||
1042 | .notifier_call = netdev_notify, | ||
1043 | }; | ||
1044 | |||
1045 | int ieee80211_iface_init(void) | ||
1046 | { | ||
1047 | return register_netdevice_notifier(&mac80211_netdev_notifier); | ||
1048 | } | ||
1049 | |||
1050 | void ieee80211_iface_exit(void) | ||
1051 | { | ||
1052 | unregister_netdevice_notifier(&mac80211_netdev_notifier); | ||
1053 | } | ||