diff options
author | Dan Williams <dcbw@redhat.com> | 2007-05-10 22:51:28 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2007-05-11 14:54:52 -0400 |
commit | 51b0c9d09d0a889a232605e71555e390b3b110fb (patch) | |
tree | 204f0d5eab138d5af6f0e044261220a361ed851a /drivers/net | |
parent | 1f8a6b658a943b4f04a1fc7b3a420360202c86cd (diff) |
[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: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/libertas/scan.c | 113 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/scan.h | 8 |
2 files changed, 49 insertions, 72 deletions
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index e18706238951..ff1270e1b694 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c | |||
@@ -95,10 +95,9 @@ static int is_network_compatible(wlan_adapter * adapter, int index, int mode) | |||
95 | if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled | 95 | if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled |
96 | && !adapter->secinfo.WPAenabled | 96 | && !adapter->secinfo.WPAenabled |
97 | && !adapter->secinfo.WPA2enabled | 97 | && !adapter->secinfo.WPA2enabled |
98 | && adapter->scantable[index].wpa_supplicant.wpa_ie[0] != | 98 | && adapter->scantable[index].wpa_ie[0] != WPA_IE |
99 | WPA_IE | 99 | && adapter->scantable[index].rsn_ie[0] != WPA2_IE |
100 | && adapter->scantable[index].wpa2_supplicant.wpa_ie[0] != | 100 | && adapter->secinfo.Encryptionmode == CIPHER_NONE |
101 | WPA2_IE && adapter->secinfo.Encryptionmode == CIPHER_NONE | ||
102 | && !adapter->scantable[index].privacy) { | 101 | && !adapter->scantable[index].privacy) { |
103 | /* no security */ | 102 | /* no security */ |
104 | LEAVE(); | 103 | LEAVE(); |
@@ -113,21 +112,17 @@ static int is_network_compatible(wlan_adapter * adapter, int index, int mode) | |||
113 | } else if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled | 112 | } else if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled |
114 | && adapter->secinfo.WPAenabled | 113 | && adapter->secinfo.WPAenabled |
115 | && !adapter->secinfo.WPA2enabled | 114 | && !adapter->secinfo.WPA2enabled |
116 | && (adapter->scantable[index].wpa_supplicant. | 115 | && (adapter->scantable[index].wpa_ie[0] == WPA_IE) |
117 | wpa_ie[0] | ||
118 | == WPA_IE) | ||
119 | /* privacy bit may NOT be set in some APs like LinkSys WRT54G | 116 | /* privacy bit may NOT be set in some APs like LinkSys WRT54G |
120 | && adapter->scantable[index].privacy */ | 117 | && adapter->scantable[index].privacy */ |
121 | ) { | 118 | ) { |
122 | /* WPA enabled */ | 119 | /* WPA enabled */ |
123 | lbs_pr_debug(1, | 120 | lbs_pr_debug(1, |
124 | "is_network_compatible() WPA: index=%d wpa_ie=%#x " | 121 | "is_network_compatible() WPA: index=%d wpa_ie=%#x " |
125 | "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s Encmode=%#x " | 122 | "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s Encmode=%#x " |
126 | "privacy=%#x\n", index, | 123 | "privacy=%#x\n", index, |
127 | adapter->scantable[index].wpa_supplicant. | 124 | adapter->scantable[index].wpa_ie[0], |
128 | wpa_ie[0], | 125 | adapter->scantable[index].rsn_ie[0], |
129 | adapter->scantable[index].wpa2_supplicant. | ||
130 | wpa_ie[0], | ||
131 | (adapter->secinfo.WEPstatus == | 126 | (adapter->secinfo.WEPstatus == |
132 | wlan802_11WEPenabled) ? "e" : "d", | 127 | wlan802_11WEPenabled) ? "e" : "d", |
133 | (adapter->secinfo.WPAenabled) ? "e" : "d", | 128 | (adapter->secinfo.WPAenabled) ? "e" : "d", |
@@ -139,21 +134,17 @@ static int is_network_compatible(wlan_adapter * adapter, int index, int mode) | |||
139 | } else if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled | 134 | } else if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled |
140 | && !adapter->secinfo.WPAenabled | 135 | && !adapter->secinfo.WPAenabled |
141 | && adapter->secinfo.WPA2enabled | 136 | && adapter->secinfo.WPA2enabled |
142 | && (adapter->scantable[index].wpa2_supplicant. | 137 | && (adapter->scantable[index].rsn_ie[0] == WPA2_IE) |
143 | wpa_ie[0] | ||
144 | == WPA2_IE) | ||
145 | /* privacy bit may NOT be set in some APs like LinkSys WRT54G | 138 | /* privacy bit may NOT be set in some APs like LinkSys WRT54G |
146 | && adapter->scantable[index].privacy */ | 139 | && adapter->scantable[index].privacy */ |
147 | ) { | 140 | ) { |
148 | /* WPA2 enabled */ | 141 | /* WPA2 enabled */ |
149 | lbs_pr_debug(1, | 142 | lbs_pr_debug(1, |
150 | "is_network_compatible() WPA2: index=%d wpa_ie=%#x " | 143 | "is_network_compatible() WPA2: index=%d wpa_ie=%#x " |
151 | "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s Encmode=%#x " | 144 | "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s Encmode=%#x " |
152 | "privacy=%#x\n", index, | 145 | "privacy=%#x\n", index, |
153 | adapter->scantable[index].wpa_supplicant. | 146 | adapter->scantable[index].wpa_ie[0], |
154 | wpa_ie[0], | 147 | adapter->scantable[index].rsn_ie[0], |
155 | adapter->scantable[index].wpa2_supplicant. | ||
156 | wpa_ie[0], | ||
157 | (adapter->secinfo.WEPstatus == | 148 | (adapter->secinfo.WEPstatus == |
158 | wlan802_11WEPenabled) ? "e" : "d", | 149 | wlan802_11WEPenabled) ? "e" : "d", |
159 | (adapter->secinfo.WPAenabled) ? "e" : "d", | 150 | (adapter->secinfo.WPAenabled) ? "e" : "d", |
@@ -165,35 +156,30 @@ static int is_network_compatible(wlan_adapter * adapter, int index, int mode) | |||
165 | } else if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled | 156 | } else if (adapter->secinfo.WEPstatus == wlan802_11WEPdisabled |
166 | && !adapter->secinfo.WPAenabled | 157 | && !adapter->secinfo.WPAenabled |
167 | && !adapter->secinfo.WPA2enabled | 158 | && !adapter->secinfo.WPA2enabled |
168 | && (adapter->scantable[index].wpa_supplicant. | 159 | && (adapter->scantable[index].wpa_ie[0] != WPA_IE) |
169 | wpa_ie[0] | 160 | && (adapter->scantable[index].rsn_ie[0] != WPA2_IE) |
170 | != WPA_IE) | ||
171 | && (adapter->scantable[index].wpa2_supplicant. | ||
172 | wpa_ie[0] | ||
173 | != WPA2_IE) | ||
174 | && adapter->secinfo.Encryptionmode != CIPHER_NONE | 161 | && adapter->secinfo.Encryptionmode != CIPHER_NONE |
175 | && adapter->scantable[index].privacy) { | 162 | && adapter->scantable[index].privacy) { |
176 | /* dynamic WEP enabled */ | 163 | /* dynamic WEP enabled */ |
177 | lbs_pr_debug(1, | 164 | lbs_pr_debug(1, |
178 | "is_network_compatible() dynamic WEP: index=%d " | 165 | "is_network_compatible() dynamic WEP: index=%d " |
179 | "wpa_ie=%#x wpa2_ie=%#x Encmode=%#x privacy=%#x\n", | 166 | "wpa_ie=%#x wpa2_ie=%#x Encmode=%#x privacy=%#x\n", |
180 | index, | 167 | index, |
181 | adapter->scantable[index].wpa_supplicant. | 168 | adapter->scantable[index].wpa_ie[0], |
182 | wpa_ie[0], | 169 | adapter->scantable[index].rsn_ie[0], |
183 | adapter->scantable[index].wpa2_supplicant. | 170 | adapter->secinfo.Encryptionmode, |
184 | wpa_ie[0], adapter->secinfo.Encryptionmode, | ||
185 | adapter->scantable[index].privacy); | 171 | adapter->scantable[index].privacy); |
186 | LEAVE(); | 172 | LEAVE(); |
187 | return index; | 173 | return index; |
188 | } | 174 | } |
189 | 175 | ||
190 | /* security doesn't match */ | 176 | /* security doesn't match */ |
191 | lbs_pr_debug(1, | 177 | lbs_pr_debug(1, |
192 | "is_network_compatible() FAILED: index=%d wpa_ie=%#x " | 178 | "is_network_compatible() FAILED: index=%d wpa_ie=%#x " |
193 | "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s Encmode=%#x privacy=%#x\n", | 179 | "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s Encmode=%#x privacy=%#x\n", |
194 | index, | 180 | index, |
195 | adapter->scantable[index].wpa_supplicant.wpa_ie[0], | 181 | adapter->scantable[index].wpa_ie[0], |
196 | adapter->scantable[index].wpa2_supplicant.wpa_ie[0], | 182 | adapter->scantable[index].rsn_ie[0], |
197 | (adapter->secinfo.WEPstatus == | 183 | (adapter->secinfo.WEPstatus == |
198 | wlan802_11WEPenabled) ? "e" : "d", | 184 | wlan802_11WEPenabled) ? "e" : "d", |
199 | (adapter->secinfo.WPAenabled) ? "e" : "d", | 185 | (adapter->secinfo.WPAenabled) ? "e" : "d", |
@@ -924,8 +910,6 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry, | |||
924 | u8 founddatarateie; | 910 | u8 founddatarateie; |
925 | int bytesleftforcurrentbeacon; | 911 | int bytesleftforcurrentbeacon; |
926 | 912 | ||
927 | struct WPA_SUPPLICANT *pwpa_supplicant; | ||
928 | struct WPA_SUPPLICANT *pwpa2_supplicant; | ||
929 | struct IE_WPA *pIe; | 913 | struct IE_WPA *pIe; |
930 | const u8 oui01[4] = { 0x00, 0x50, 0xf2, 0x01 }; | 914 | const u8 oui01[4] = { 0x00, 0x50, 0xf2, 0x01 }; |
931 | 915 | ||
@@ -962,9 +946,6 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry, | |||
962 | 946 | ||
963 | bytesleftforcurrentbeacon = beaconsize; | 947 | bytesleftforcurrentbeacon = beaconsize; |
964 | 948 | ||
965 | pwpa_supplicant = &pBSSEntry->wpa_supplicant; | ||
966 | pwpa2_supplicant = &pBSSEntry->wpa2_supplicant; | ||
967 | |||
968 | memcpy(pBSSEntry->macaddress, pcurrentptr, ETH_ALEN); | 949 | memcpy(pBSSEntry->macaddress, pcurrentptr, ETH_ALEN); |
969 | lbs_pr_debug(1, "InterpretIE: AP MAC Addr-%x:%x:%x:%x:%x:%x\n", | 950 | lbs_pr_debug(1, "InterpretIE: AP MAC Addr-%x:%x:%x:%x:%x:%x\n", |
970 | pBSSEntry->macaddress[0], pBSSEntry->macaddress[1], | 951 | pBSSEntry->macaddress[0], pBSSEntry->macaddress[1], |
@@ -1160,27 +1141,27 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry, | |||
1160 | #define IE_ID_LEN_FIELDS_BYTES 2 | 1141 | #define IE_ID_LEN_FIELDS_BYTES 2 |
1161 | pIe = (struct IE_WPA *)pcurrentptr; | 1142 | pIe = (struct IE_WPA *)pcurrentptr; |
1162 | 1143 | ||
1163 | if (!memcmp(pIe->oui, oui01, sizeof(oui01))) { | 1144 | if (memcmp(pIe->oui, oui01, sizeof(oui01))) |
1164 | pwpa_supplicant->wpa_ie_len | 1145 | break; |
1165 | = min_t(size_t, elemlen + IE_ID_LEN_FIELDS_BYTES, | 1146 | |
1166 | sizeof(pwpa_supplicant->wpa_ie)); | 1147 | pBSSEntry->wpa_ie_len = min_t(size_t, |
1167 | memcpy(pwpa_supplicant->wpa_ie, | 1148 | elemlen + IE_ID_LEN_FIELDS_BYTES, |
1168 | pcurrentptr, | 1149 | sizeof(pBSSEntry->wpa_ie)); |
1169 | pwpa_supplicant->wpa_ie_len); | 1150 | memcpy(pBSSEntry->wpa_ie, pcurrentptr, |
1170 | lbs_dbg_hex("InterpretIE: Resp WPA_IE", | 1151 | pBSSEntry->wpa_ie_len); |
1171 | pwpa_supplicant->wpa_ie, elemlen); | 1152 | lbs_dbg_hex("InterpretIE: Resp WPA_IE", |
1172 | } | 1153 | pBSSEntry->wpa_ie, elemlen); |
1173 | break; | 1154 | break; |
1174 | case WPA2_IE: | 1155 | case WPA2_IE: |
1175 | pIe = (struct IE_WPA *)pcurrentptr; | 1156 | pIe = (struct IE_WPA *)pcurrentptr; |
1176 | pwpa2_supplicant->wpa_ie_len | ||
1177 | = min_t(size_t, elemlen + IE_ID_LEN_FIELDS_BYTES, | ||
1178 | sizeof(pwpa2_supplicant->wpa_ie)); | ||
1179 | memcpy(pwpa2_supplicant->wpa_ie, | ||
1180 | pcurrentptr, pwpa2_supplicant->wpa_ie_len); | ||
1181 | 1157 | ||
1158 | pBSSEntry->rsn_ie_len = min_t(size_t, | ||
1159 | elemlen + IE_ID_LEN_FIELDS_BYTES, | ||
1160 | sizeof(pBSSEntry->rsn_ie)); | ||
1161 | memcpy(pBSSEntry->rsn_ie, pcurrentptr, | ||
1162 | pBSSEntry->rsn_ie_len); | ||
1182 | lbs_dbg_hex("InterpretIE: Resp WPA2_IE", | 1163 | lbs_dbg_hex("InterpretIE: Resp WPA2_IE", |
1183 | pwpa2_supplicant->wpa_ie, elemlen); | 1164 | pBSSEntry->rsn_ie, elemlen); |
1184 | break; | 1165 | break; |
1185 | case TIM: | 1166 | case TIM: |
1186 | break; | 1167 | break; |
@@ -1745,30 +1726,24 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info, | |||
1745 | /* Add new value to event */ | 1726 | /* Add new value to event */ |
1746 | current_val = current_ev + IW_EV_LCP_LEN; | 1727 | current_val = current_ev + IW_EV_LCP_LEN; |
1747 | 1728 | ||
1748 | if (adapter->scantable[i].wpa2_supplicant.wpa_ie[0] == WPA2_IE) { | 1729 | if (adapter->scantable[i].rsn_ie[0] == WPA2_IE) { |
1749 | memset(&iwe, 0, sizeof(iwe)); | 1730 | memset(&iwe, 0, sizeof(iwe)); |
1750 | memset(buf, 0, sizeof(buf)); | 1731 | memset(buf, 0, sizeof(buf)); |
1751 | memcpy(buf, adapter->scantable[i]. | 1732 | memcpy(buf, adapter->scantable[i].rsn_ie, |
1752 | wpa2_supplicant.wpa_ie, | 1733 | adapter->scantable[i].rsn_ie_len); |
1753 | adapter->scantable[i].wpa2_supplicant. | ||
1754 | wpa_ie_len); | ||
1755 | iwe.cmd = IWEVGENIE; | 1734 | iwe.cmd = IWEVGENIE; |
1756 | iwe.u.data.length = adapter->scantable[i]. | 1735 | iwe.u.data.length = adapter->scantable[i].rsn_ie_len; |
1757 | wpa2_supplicant.wpa_ie_len; | ||
1758 | iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; | 1736 | iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; |
1759 | current_ev = iwe_stream_add_point(current_ev, end_buf, | 1737 | current_ev = iwe_stream_add_point(current_ev, end_buf, |
1760 | &iwe, buf); | 1738 | &iwe, buf); |
1761 | } | 1739 | } |
1762 | if (adapter->scantable[i].wpa_supplicant.wpa_ie[0] == WPA_IE) { | 1740 | if (adapter->scantable[i].wpa_ie[0] == WPA_IE) { |
1763 | memset(&iwe, 0, sizeof(iwe)); | 1741 | memset(&iwe, 0, sizeof(iwe)); |
1764 | memset(buf, 0, sizeof(buf)); | 1742 | memset(buf, 0, sizeof(buf)); |
1765 | memcpy(buf, adapter->scantable[i]. | 1743 | memcpy(buf, adapter->scantable[i].wpa_ie, |
1766 | wpa_supplicant.wpa_ie, | 1744 | adapter->scantable[i].wpa_ie_len); |
1767 | adapter->scantable[i].wpa_supplicant. | ||
1768 | wpa_ie_len); | ||
1769 | iwe.cmd = IWEVGENIE; | 1745 | iwe.cmd = IWEVGENIE; |
1770 | iwe.u.data.length = adapter->scantable[i]. | 1746 | iwe.u.data.length = adapter->scantable[i].wpa_ie_len; |
1771 | wpa_supplicant.wpa_ie_len; | ||
1772 | iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; | 1747 | iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; |
1773 | current_ev = iwe_stream_add_point(current_ev, end_buf, | 1748 | current_ev = iwe_stream_add_point(current_ev, end_buf, |
1774 | &iwe, buf); | 1749 | &iwe, buf); |
diff --git a/drivers/net/wireless/libertas/scan.h b/drivers/net/wireless/libertas/scan.h index d93aa7fa44fd..1a8756edfeb5 100644 --- a/drivers/net/wireless/libertas/scan.h +++ b/drivers/net/wireless/libertas/scan.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #ifndef _WLAN_SCAN_H | 10 | #ifndef _WLAN_SCAN_H |
11 | #define _WLAN_SCAN_H | 11 | #define _WLAN_SCAN_H |
12 | 12 | ||
13 | #include <net/ieee80211.h> | ||
13 | #include "hostcmd.h" | 14 | #include "hostcmd.h" |
14 | 15 | ||
15 | /** | 16 | /** |
@@ -170,9 +171,10 @@ struct bss_descriptor { | |||
170 | 171 | ||
171 | struct ieeetypes_countryinfofullset countryinfo; | 172 | struct ieeetypes_countryinfofullset countryinfo; |
172 | 173 | ||
173 | struct WPA_SUPPLICANT wpa_supplicant; | 174 | u8 wpa_ie[MAX_WPA_IE_LEN]; |
174 | struct WPA_SUPPLICANT wpa2_supplicant; | 175 | size_t wpa_ie_len; |
175 | 176 | u8 rsn_ie[MAX_WPA_IE_LEN]; | |
177 | size_t rsn_ie_len; | ||
176 | }; | 178 | }; |
177 | 179 | ||
178 | extern int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, | 180 | extern int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, |