Commit 51b0c9d0 authored by Dan Williams's avatar Dan Williams Committed by John W. Linville

[PATCH] libertas: remove WPA_SUPPLICANT structure

Start to normalize bss_descriptor with ieee80211_network so we can
eventually replace bss_descriptor more easily.
Signed-off-by: default avatarDan Williams <dcbw@redhat.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 1f8a6b65
...@@ -95,10 +95,9 @@ static int is_network_compatible(wlan_adapter * adapter, int index, int mode) ...@@ -95,10 +95,9 @@ static int is_network_compatible(wlan_adapter * adapter, int index, int mode)
if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled
&& !adapter->secinfo.WPAenabled && !adapter->secinfo.WPAenabled
&& !adapter->secinfo.WPA2enabled && !adapter->secinfo.WPA2enabled
&& adapter->scantable[index].wpa_supplicant.wpa_ie[0] != && adapter->scantable[index].wpa_ie[0] != WPA_IE
WPA_IE && adapter->scantable[index].rsn_ie[0] != WPA2_IE
&& adapter->scantable[index].wpa2_supplicant.wpa_ie[0] != && adapter->secinfo.Encryptionmode == CIPHER_NONE
WPA2_IE && adapter->secinfo.Encryptionmode == CIPHER_NONE
&& !adapter->scantable[index].privacy) { && !adapter->scantable[index].privacy) {
/* no security */ /* no security */
LEAVE(); LEAVE();
...@@ -113,21 +112,17 @@ static int is_network_compatible(wlan_adapter * adapter, int index, int mode) ...@@ -113,21 +112,17 @@ static int is_network_compatible(wlan_adapter * adapter, int index, int mode)
} else if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled } else if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled
&& adapter->secinfo.WPAenabled && adapter->secinfo.WPAenabled
&& !adapter->secinfo.WPA2enabled && !adapter->secinfo.WPA2enabled
&& (adapter->scantable[index].wpa_supplicant. && (adapter->scantable[index].wpa_ie[0] == WPA_IE)
wpa_ie[0]
== WPA_IE)
/* privacy bit may NOT be set in some APs like LinkSys WRT54G /* privacy bit may NOT be set in some APs like LinkSys WRT54G
&& adapter->scantable[index].privacy */ && adapter->scantable[index].privacy */
) { ) {
/* WPA enabled */ /* WPA enabled */
lbs_pr_debug(1, lbs_pr_debug(1,
"is_network_compatible() WPA: index=%d wpa_ie=%#x " "is_network_compatible() WPA: index=%d wpa_ie=%#x "
"wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s Encmode=%#x " "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s Encmode=%#x "
"privacy=%#x\n", index, "privacy=%#x\n", index,
adapter->scantable[index].wpa_supplicant. adapter->scantable[index].wpa_ie[0],
wpa_ie[0], adapter->scantable[index].rsn_ie[0],
adapter->scantable[index].wpa2_supplicant.
wpa_ie[0],
(adapter->secinfo.WEPstatus == (adapter->secinfo.WEPstatus ==
wlan802_11WEPenabled) ? "e" : "d", wlan802_11WEPenabled) ? "e" : "d",
(adapter->secinfo.WPAenabled) ? "e" : "d", (adapter->secinfo.WPAenabled) ? "e" : "d",
...@@ -139,21 +134,17 @@ static int is_network_compatible(wlan_adapter * adapter, int index, int mode) ...@@ -139,21 +134,17 @@ static int is_network_compatible(wlan_adapter * adapter, int index, int mode)
} else if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled } else if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled
&& !adapter->secinfo.WPAenabled && !adapter->secinfo.WPAenabled
&& adapter->secinfo.WPA2enabled && adapter->secinfo.WPA2enabled
&& (adapter->scantable[index].wpa2_supplicant. && (adapter->scantable[index].rsn_ie[0] == WPA2_IE)
wpa_ie[0]
== WPA2_IE)
/* privacy bit may NOT be set in some APs like LinkSys WRT54G /* privacy bit may NOT be set in some APs like LinkSys WRT54G
&& adapter->scantable[index].privacy */ && adapter->scantable[index].privacy */
) { ) {
/* WPA2 enabled */ /* WPA2 enabled */
lbs_pr_debug(1, lbs_pr_debug(1,
"is_network_compatible() WPA2: index=%d wpa_ie=%#x " "is_network_compatible() WPA2: index=%d wpa_ie=%#x "
"wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s Encmode=%#x " "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s Encmode=%#x "
"privacy=%#x\n", index, "privacy=%#x\n", index,
adapter->scantable[index].wpa_supplicant. adapter->scantable[index].wpa_ie[0],
wpa_ie[0], adapter->scantable[index].rsn_ie[0],
adapter->scantable[index].wpa2_supplicant.
wpa_ie[0],
(adapter->secinfo.WEPstatus == (adapter->secinfo.WEPstatus ==
wlan802_11WEPenabled) ? "e" : "d", wlan802_11WEPenabled) ? "e" : "d",
(adapter->secinfo.WPAenabled) ? "e" : "d", (adapter->secinfo.WPAenabled) ? "e" : "d",
...@@ -165,35 +156,30 @@ static int is_network_compatible(wlan_adapter * adapter, int index, int mode) ...@@ -165,35 +156,30 @@ static int is_network_compatible(wlan_adapter * adapter, int index, int mode)
} else if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled } else if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled
&& !adapter->secinfo.WPAenabled && !adapter->secinfo.WPAenabled
&& !adapter->secinfo.WPA2enabled && !adapter->secinfo.WPA2enabled
&& (adapter->scantable[index].wpa_supplicant. && (adapter->scantable[index].wpa_ie[0] != WPA_IE)
wpa_ie[0] && (adapter->scantable[index].rsn_ie[0] != WPA2_IE)
!= WPA_IE)
&& (adapter->scantable[index].wpa2_supplicant.
wpa_ie[0]
!= WPA2_IE)
&& adapter->secinfo.Encryptionmode != CIPHER_NONE && adapter->secinfo.Encryptionmode != CIPHER_NONE
&& adapter->scantable[index].privacy) { && adapter->scantable[index].privacy) {
/* dynamic WEP enabled */ /* dynamic WEP enabled */
lbs_pr_debug(1, lbs_pr_debug(1,
"is_network_compatible() dynamic WEP: index=%d " "is_network_compatible() dynamic WEP: index=%d "
"wpa_ie=%#x wpa2_ie=%#x Encmode=%#x privacy=%#x\n", "wpa_ie=%#x wpa2_ie=%#x Encmode=%#x privacy=%#x\n",
index, index,
adapter->scantable[index].wpa_supplicant. adapter->scantable[index].wpa_ie[0],
wpa_ie[0], adapter->scantable[index].rsn_ie[0],
adapter->scantable[index].wpa2_supplicant. adapter->secinfo.Encryptionmode,
wpa_ie[0], adapter->secinfo.Encryptionmode,
adapter->scantable[index].privacy); adapter->scantable[index].privacy);
LEAVE(); LEAVE();
return index; return index;
} }
/* security doesn't match */ /* security doesn't match */
lbs_pr_debug(1, lbs_pr_debug(1,
"is_network_compatible() FAILED: index=%d wpa_ie=%#x " "is_network_compatible() FAILED: index=%d wpa_ie=%#x "
"wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s Encmode=%#x privacy=%#x\n", "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s Encmode=%#x privacy=%#x\n",
index, index,
adapter->scantable[index].wpa_supplicant.wpa_ie[0], adapter->scantable[index].wpa_ie[0],
adapter->scantable[index].wpa2_supplicant.wpa_ie[0], adapter->scantable[index].rsn_ie[0],
(adapter->secinfo.WEPstatus == (adapter->secinfo.WEPstatus ==
wlan802_11WEPenabled) ? "e" : "d", wlan802_11WEPenabled) ? "e" : "d",
(adapter->secinfo.WPAenabled) ? "e" : "d", (adapter->secinfo.WPAenabled) ? "e" : "d",
...@@ -924,8 +910,6 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry, ...@@ -924,8 +910,6 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
u8 founddatarateie; u8 founddatarateie;
int bytesleftforcurrentbeacon; int bytesleftforcurrentbeacon;
struct WPA_SUPPLICANT *pwpa_supplicant;
struct WPA_SUPPLICANT *pwpa2_supplicant;
struct IE_WPA *pIe; struct IE_WPA *pIe;
const u8 oui01[4] = { 0x00, 0x50, 0xf2, 0x01 }; const u8 oui01[4] = { 0x00, 0x50, 0xf2, 0x01 };
...@@ -962,9 +946,6 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry, ...@@ -962,9 +946,6 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
bytesleftforcurrentbeacon = beaconsize; bytesleftforcurrentbeacon = beaconsize;
pwpa_supplicant = &pBSSEntry->wpa_supplicant;
pwpa2_supplicant = &pBSSEntry->wpa2_supplicant;
memcpy(pBSSEntry->macaddress, pcurrentptr, ETH_ALEN); memcpy(pBSSEntry->macaddress, pcurrentptr, ETH_ALEN);
lbs_pr_debug(1, "InterpretIE: AP MAC Addr-%x:%x:%x:%x:%x:%x\n", lbs_pr_debug(1, "InterpretIE: AP MAC Addr-%x:%x:%x:%x:%x:%x\n",
pBSSEntry->macaddress[0], pBSSEntry->macaddress[1], pBSSEntry->macaddress[0], pBSSEntry->macaddress[1],
...@@ -1160,27 +1141,27 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry, ...@@ -1160,27 +1141,27 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
#define IE_ID_LEN_FIELDS_BYTES 2 #define IE_ID_LEN_FIELDS_BYTES 2
pIe = (struct IE_WPA *)pcurrentptr; pIe = (struct IE_WPA *)pcurrentptr;
if (!memcmp(pIe->oui, oui01, sizeof(oui01))) { if (memcmp(pIe->oui, oui01, sizeof(oui01)))
pwpa_supplicant->wpa_ie_len break;
= min_t(size_t, elemlen + IE_ID_LEN_FIELDS_BYTES,
sizeof(pwpa_supplicant->wpa_ie)); pBSSEntry->wpa_ie_len = min_t(size_t,
memcpy(pwpa_supplicant->wpa_ie, elemlen + IE_ID_LEN_FIELDS_BYTES,
pcurrentptr, sizeof(pBSSEntry->wpa_ie));
pwpa_supplicant->wpa_ie_len); memcpy(pBSSEntry->wpa_ie, pcurrentptr,
lbs_dbg_hex("InterpretIE: Resp WPA_IE", pBSSEntry->wpa_ie_len);
pwpa_supplicant->wpa_ie, elemlen); lbs_dbg_hex("InterpretIE: Resp WPA_IE",
} pBSSEntry->wpa_ie, elemlen);
break; break;
case WPA2_IE: case WPA2_IE:
pIe = (struct IE_WPA *)pcurrentptr; pIe = (struct IE_WPA *)pcurrentptr;
pwpa2_supplicant->wpa_ie_len
= min_t(size_t, elemlen + IE_ID_LEN_FIELDS_BYTES,
sizeof(pwpa2_supplicant->wpa_ie));
memcpy(pwpa2_supplicant->wpa_ie,
pcurrentptr, pwpa2_supplicant->wpa_ie_len);
pBSSEntry->rsn_ie_len = min_t(size_t,
elemlen + IE_ID_LEN_FIELDS_BYTES,
sizeof(pBSSEntry->rsn_ie));
memcpy(pBSSEntry->rsn_ie, pcurrentptr,
pBSSEntry->rsn_ie_len);
lbs_dbg_hex("InterpretIE: Resp WPA2_IE", lbs_dbg_hex("InterpretIE: Resp WPA2_IE",
pwpa2_supplicant->wpa_ie, elemlen); pBSSEntry->rsn_ie, elemlen);
break; break;
case TIM: case TIM:
break; break;
...@@ -1745,30 +1726,24 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info, ...@@ -1745,30 +1726,24 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
/* Add new value to event */ /* Add new value to event */
current_val = current_ev + IW_EV_LCP_LEN; current_val = current_ev + IW_EV_LCP_LEN;
if (adapter->scantable[i].wpa2_supplicant.wpa_ie[0] == WPA2_IE) { if (adapter->scantable[i].rsn_ie[0] == WPA2_IE) {
memset(&iwe, 0, sizeof(iwe)); memset(&iwe, 0, sizeof(iwe));
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
memcpy(buf, adapter->scantable[i]. memcpy(buf, adapter->scantable[i].rsn_ie,
wpa2_supplicant.wpa_ie, adapter->scantable[i].rsn_ie_len);
adapter->scantable[i].wpa2_supplicant.
wpa_ie_len);
iwe.cmd = IWEVGENIE; iwe.cmd = IWEVGENIE;
iwe.u.data.length = adapter->scantable[i]. iwe.u.data.length = adapter->scantable[i].rsn_ie_len;
wpa2_supplicant.wpa_ie_len;
iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
current_ev = iwe_stream_add_point(current_ev, end_buf, current_ev = iwe_stream_add_point(current_ev, end_buf,
&iwe, buf); &iwe, buf);
} }
if (adapter->scantable[i].wpa_supplicant.wpa_ie[0] == WPA_IE) { if (adapter->scantable[i].wpa_ie[0] == WPA_IE) {
memset(&iwe, 0, sizeof(iwe)); memset(&iwe, 0, sizeof(iwe));
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
memcpy(buf, adapter->scantable[i]. memcpy(buf, adapter->scantable[i].wpa_ie,
wpa_supplicant.wpa_ie, adapter->scantable[i].wpa_ie_len);
adapter->scantable[i].wpa_supplicant.
wpa_ie_len);
iwe.cmd = IWEVGENIE; iwe.cmd = IWEVGENIE;
iwe.u.data.length = adapter->scantable[i]. iwe.u.data.length = adapter->scantable[i].wpa_ie_len;
wpa_supplicant.wpa_ie_len;
iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
current_ev = iwe_stream_add_point(current_ev, end_buf, current_ev = iwe_stream_add_point(current_ev, end_buf,
&iwe, buf); &iwe, buf);
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#ifndef _WLAN_SCAN_H #ifndef _WLAN_SCAN_H
#define _WLAN_SCAN_H #define _WLAN_SCAN_H
#include <net/ieee80211.h>
#include "hostcmd.h" #include "hostcmd.h"
/** /**
...@@ -170,9 +171,10 @@ struct bss_descriptor { ...@@ -170,9 +171,10 @@ struct bss_descriptor {
struct ieeetypes_countryinfofullset countryinfo; struct ieeetypes_countryinfofullset countryinfo;
struct WPA_SUPPLICANT wpa_supplicant; u8 wpa_ie[MAX_WPA_IE_LEN];
struct WPA_SUPPLICANT wpa2_supplicant; size_t wpa_ie_len;
u8 rsn_ie[MAX_WPA_IE_LEN];
size_t rsn_ie_len;
}; };
extern int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, extern int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment