util.c (67cbf8a216259dceefe570f6dc14746f43b2e627) util.c (47846c9b0c10808d9337d2e7d09361f3e0a0a71a)
1/*
2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2005-2006, Devicescape Software, Inc.
4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
5 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 455 unchanged lines hidden (view full) ---

464 case NL80211_IFTYPE_AP:
465 case NL80211_IFTYPE_STATION:
466 case NL80211_IFTYPE_ADHOC:
467 case NL80211_IFTYPE_WDS:
468 case NL80211_IFTYPE_MESH_POINT:
469 break;
470 }
471 if (netif_running(sdata->dev))
1/*
2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2005-2006, Devicescape Software, Inc.
4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
5 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 455 unchanged lines hidden (view full) ---

464 case NL80211_IFTYPE_AP:
465 case NL80211_IFTYPE_STATION:
466 case NL80211_IFTYPE_ADHOC:
467 case NL80211_IFTYPE_WDS:
468 case NL80211_IFTYPE_MESH_POINT:
469 break;
470 }
471 if (netif_running(sdata->dev))
472 iterator(data, sdata->dev->dev_addr,
472 iterator(data, sdata->vif.addr,
473 &sdata->vif);
474 }
475
476 mutex_unlock(&local->iflist_mtx);
477}
478EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces);
479
480void ieee80211_iterate_active_interfaces_atomic(

--- 17 unchanged lines hidden (view full) ---

498 case NL80211_IFTYPE_AP:
499 case NL80211_IFTYPE_STATION:
500 case NL80211_IFTYPE_ADHOC:
501 case NL80211_IFTYPE_WDS:
502 case NL80211_IFTYPE_MESH_POINT:
503 break;
504 }
505 if (netif_running(sdata->dev))
473 &sdata->vif);
474 }
475
476 mutex_unlock(&local->iflist_mtx);
477}
478EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces);
479
480void ieee80211_iterate_active_interfaces_atomic(

--- 17 unchanged lines hidden (view full) ---

498 case NL80211_IFTYPE_AP:
499 case NL80211_IFTYPE_STATION:
500 case NL80211_IFTYPE_ADHOC:
501 case NL80211_IFTYPE_WDS:
502 case NL80211_IFTYPE_MESH_POINT:
503 break;
504 }
505 if (netif_running(sdata->dev))
506 iterator(data, sdata->dev->dev_addr,
506 iterator(data, sdata->vif.addr,
507 &sdata->vif);
508 }
509
510 rcu_read_unlock();
511}
512EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces_atomic);
513
514/*

--- 59 unchanged lines hidden (view full) ---

574
575 id = *pos++;
576 elen = *pos++;
577 left -= 2;
578
579 if (elen > left)
580 break;
581
507 &sdata->vif);
508 }
509
510 rcu_read_unlock();
511}
512EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces_atomic);
513
514/*

--- 59 unchanged lines hidden (view full) ---

574
575 id = *pos++;
576 elen = *pos++;
577 left -= 2;
578
579 if (elen > left)
580 break;
581
582 if (calc_crc && id < 64 && (filter & (1ULL << id)))
582 if (calc_crc && id < 64 && (filter & BIT(id)))
583 crc = crc32_be(crc, pos - 2, elen + 2);
584
585 switch (id) {
586 case WLAN_EID_SSID:
587 elems->ssid = pos;
588 elems->ssid_len = elen;
589 break;
590 case WLAN_EID_SUPP_RATES:

--- 252 unchanged lines hidden (view full) ---

843 struct sk_buff *skb;
844 struct ieee80211_mgmt *mgmt;
845 int err;
846
847 skb = dev_alloc_skb(local->hw.extra_tx_headroom +
848 sizeof(*mgmt) + 6 + extra_len);
849 if (!skb) {
850 printk(KERN_DEBUG "%s: failed to allocate buffer for auth "
583 crc = crc32_be(crc, pos - 2, elen + 2);
584
585 switch (id) {
586 case WLAN_EID_SSID:
587 elems->ssid = pos;
588 elems->ssid_len = elen;
589 break;
590 case WLAN_EID_SUPP_RATES:

--- 252 unchanged lines hidden (view full) ---

843 struct sk_buff *skb;
844 struct ieee80211_mgmt *mgmt;
845 int err;
846
847 skb = dev_alloc_skb(local->hw.extra_tx_headroom +
848 sizeof(*mgmt) + 6 + extra_len);
849 if (!skb) {
850 printk(KERN_DEBUG "%s: failed to allocate buffer for auth "
851 "frame\n", sdata->dev->name);
851 "frame\n", sdata->name);
852 return;
853 }
854 skb_reserve(skb, local->hw.extra_tx_headroom);
855
856 mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24 + 6);
857 memset(mgmt, 0, 24 + 6);
858 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
859 IEEE80211_STYPE_AUTH);
860 memcpy(mgmt->da, bssid, ETH_ALEN);
852 return;
853 }
854 skb_reserve(skb, local->hw.extra_tx_headroom);
855
856 mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24 + 6);
857 memset(mgmt, 0, 24 + 6);
858 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
859 IEEE80211_STYPE_AUTH);
860 memcpy(mgmt->da, bssid, ETH_ALEN);
861 memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN);
861 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
862 memcpy(mgmt->bssid, bssid, ETH_ALEN);
863 mgmt->u.auth.auth_alg = cpu_to_le16(auth_alg);
864 mgmt->u.auth.auth_transaction = cpu_to_le16(transaction);
865 mgmt->u.auth.status_code = cpu_to_le16(0);
866 if (extra)
867 memcpy(skb_put(skb, extra_len), extra, extra_len);
868
869 if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) {

--- 74 unchanged lines hidden (view full) ---

944 struct sk_buff *skb;
945 struct ieee80211_mgmt *mgmt;
946 u8 *pos;
947
948 skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt) + 200 +
949 ie_len);
950 if (!skb) {
951 printk(KERN_DEBUG "%s: failed to allocate buffer for probe "
862 memcpy(mgmt->bssid, bssid, ETH_ALEN);
863 mgmt->u.auth.auth_alg = cpu_to_le16(auth_alg);
864 mgmt->u.auth.auth_transaction = cpu_to_le16(transaction);
865 mgmt->u.auth.status_code = cpu_to_le16(0);
866 if (extra)
867 memcpy(skb_put(skb, extra_len), extra, extra_len);
868
869 if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) {

--- 74 unchanged lines hidden (view full) ---

944 struct sk_buff *skb;
945 struct ieee80211_mgmt *mgmt;
946 u8 *pos;
947
948 skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt) + 200 +
949 ie_len);
950 if (!skb) {
951 printk(KERN_DEBUG "%s: failed to allocate buffer for probe "
952 "request\n", sdata->dev->name);
952 "request\n", sdata->name);
953 return;
954 }
955 skb_reserve(skb, local->hw.extra_tx_headroom);
956
957 mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24);
958 memset(mgmt, 0, 24);
959 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
960 IEEE80211_STYPE_PROBE_REQ);
953 return;
954 }
955 skb_reserve(skb, local->hw.extra_tx_headroom);
956
957 mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24);
958 memset(mgmt, 0, 24);
959 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
960 IEEE80211_STYPE_PROBE_REQ);
961 memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN);
961 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
962 if (dst) {
963 memcpy(mgmt->da, dst, ETH_ALEN);
964 memcpy(mgmt->bssid, dst, ETH_ALEN);
965 } else {
966 memset(mgmt->da, 0xff, ETH_ALEN);
967 memset(mgmt->bssid, 0xff, ETH_ALEN);
968 }
969 pos = skb_put(skb, 2 + ssid_len);

--- 76 unchanged lines hidden (view full) ---

1046
1047 /* add interfaces */
1048 list_for_each_entry(sdata, &local->interfaces, list) {
1049 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
1050 sdata->vif.type != NL80211_IFTYPE_MONITOR &&
1051 netif_running(sdata->dev)) {
1052 conf.vif = &sdata->vif;
1053 conf.type = sdata->vif.type;
962 if (dst) {
963 memcpy(mgmt->da, dst, ETH_ALEN);
964 memcpy(mgmt->bssid, dst, ETH_ALEN);
965 } else {
966 memset(mgmt->da, 0xff, ETH_ALEN);
967 memset(mgmt->bssid, 0xff, ETH_ALEN);
968 }
969 pos = skb_put(skb, 2 + ssid_len);

--- 76 unchanged lines hidden (view full) ---

1046
1047 /* add interfaces */
1048 list_for_each_entry(sdata, &local->interfaces, list) {
1049 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
1050 sdata->vif.type != NL80211_IFTYPE_MONITOR &&
1051 netif_running(sdata->dev)) {
1052 conf.vif = &sdata->vif;
1053 conf.type = sdata->vif.type;
1054 conf.mac_addr = sdata->dev->dev_addr;
1054 conf.mac_addr = sdata->vif.addr;
1055 res = drv_add_interface(local, &conf);
1056 }
1057 }
1058
1059 /* add STAs back */
1060 if (local->ops->sta_notify) {
1061 spin_lock_irqsave(&local->sta_lock, flags);
1062 list_for_each_entry(sta, &local->sta_list, list) {

--- 110 unchanged lines hidden ---
1055 res = drv_add_interface(local, &conf);
1056 }
1057 }
1058
1059 /* add STAs back */
1060 if (local->ops->sta_notify) {
1061 spin_lock_irqsave(&local->sta_lock, flags);
1062 list_for_each_entry(sta, &local->sta_list, list) {

--- 110 unchanged lines hidden ---