diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-09-08 10:40:36 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-09-11 15:53:35 -0400 |
commit | 37ffc8da803a1151e887f2a80f08f0c49d1dc1d5 (patch) | |
tree | 9d7a5e76210cfbf33b9187287cbc0b2f7ee80cb4 /net/mac80211/mlme.c | |
parent | 5fd12d4da198647e834f93f163e20bfcdd33bad8 (diff) |
mac80211: move IE parsing to util file
Since IE parsing is required for the mlme and mesh code, it's
not a static function anyway, and it's much better to have it
in util rather than the overly large mlme.c
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r-- | net/mac80211/mlme.c | 145 |
1 files changed, 0 insertions, 145 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 2341e5b3c248..b03f1f3ef2ed 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -91,151 +91,6 @@ static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata, | |||
91 | static void sta_rx_agg_session_timer_expired(unsigned long data); | 91 | static void sta_rx_agg_session_timer_expired(unsigned long data); |
92 | 92 | ||
93 | 93 | ||
94 | void ieee802_11_parse_elems(u8 *start, size_t len, | ||
95 | struct ieee802_11_elems *elems) | ||
96 | { | ||
97 | size_t left = len; | ||
98 | u8 *pos = start; | ||
99 | |||
100 | memset(elems, 0, sizeof(*elems)); | ||
101 | elems->ie_start = start; | ||
102 | elems->total_len = len; | ||
103 | |||
104 | while (left >= 2) { | ||
105 | u8 id, elen; | ||
106 | |||
107 | id = *pos++; | ||
108 | elen = *pos++; | ||
109 | left -= 2; | ||
110 | |||
111 | if (elen > left) | ||
112 | return; | ||
113 | |||
114 | switch (id) { | ||
115 | case WLAN_EID_SSID: | ||
116 | elems->ssid = pos; | ||
117 | elems->ssid_len = elen; | ||
118 | break; | ||
119 | case WLAN_EID_SUPP_RATES: | ||
120 | elems->supp_rates = pos; | ||
121 | elems->supp_rates_len = elen; | ||
122 | break; | ||
123 | case WLAN_EID_FH_PARAMS: | ||
124 | elems->fh_params = pos; | ||
125 | elems->fh_params_len = elen; | ||
126 | break; | ||
127 | case WLAN_EID_DS_PARAMS: | ||
128 | elems->ds_params = pos; | ||
129 | elems->ds_params_len = elen; | ||
130 | break; | ||
131 | case WLAN_EID_CF_PARAMS: | ||
132 | elems->cf_params = pos; | ||
133 | elems->cf_params_len = elen; | ||
134 | break; | ||
135 | case WLAN_EID_TIM: | ||
136 | elems->tim = pos; | ||
137 | elems->tim_len = elen; | ||
138 | break; | ||
139 | case WLAN_EID_IBSS_PARAMS: | ||
140 | elems->ibss_params = pos; | ||
141 | elems->ibss_params_len = elen; | ||
142 | break; | ||
143 | case WLAN_EID_CHALLENGE: | ||
144 | elems->challenge = pos; | ||
145 | elems->challenge_len = elen; | ||
146 | break; | ||
147 | case WLAN_EID_WPA: | ||
148 | if (elen >= 4 && pos[0] == 0x00 && pos[1] == 0x50 && | ||
149 | pos[2] == 0xf2) { | ||
150 | /* Microsoft OUI (00:50:F2) */ | ||
151 | if (pos[3] == 1) { | ||
152 | /* OUI Type 1 - WPA IE */ | ||
153 | elems->wpa = pos; | ||
154 | elems->wpa_len = elen; | ||
155 | } else if (elen >= 5 && pos[3] == 2) { | ||
156 | if (pos[4] == 0) { | ||
157 | elems->wmm_info = pos; | ||
158 | elems->wmm_info_len = elen; | ||
159 | } else if (pos[4] == 1) { | ||
160 | elems->wmm_param = pos; | ||
161 | elems->wmm_param_len = elen; | ||
162 | } | ||
163 | } | ||
164 | } | ||
165 | break; | ||
166 | case WLAN_EID_RSN: | ||
167 | elems->rsn = pos; | ||
168 | elems->rsn_len = elen; | ||
169 | break; | ||
170 | case WLAN_EID_ERP_INFO: | ||
171 | elems->erp_info = pos; | ||
172 | elems->erp_info_len = elen; | ||
173 | break; | ||
174 | case WLAN_EID_EXT_SUPP_RATES: | ||
175 | elems->ext_supp_rates = pos; | ||
176 | elems->ext_supp_rates_len = elen; | ||
177 | break; | ||
178 | case WLAN_EID_HT_CAPABILITY: | ||
179 | elems->ht_cap_elem = pos; | ||
180 | elems->ht_cap_elem_len = elen; | ||
181 | break; | ||
182 | case WLAN_EID_HT_EXTRA_INFO: | ||
183 | elems->ht_info_elem = pos; | ||
184 | elems->ht_info_elem_len = elen; | ||
185 | break; | ||
186 | case WLAN_EID_MESH_ID: | ||
187 | elems->mesh_id = pos; | ||
188 | elems->mesh_id_len = elen; | ||
189 | break; | ||
190 | case WLAN_EID_MESH_CONFIG: | ||
191 | elems->mesh_config = pos; | ||
192 | elems->mesh_config_len = elen; | ||
193 | break; | ||
194 | case WLAN_EID_PEER_LINK: | ||
195 | elems->peer_link = pos; | ||
196 | elems->peer_link_len = elen; | ||
197 | break; | ||
198 | case WLAN_EID_PREQ: | ||
199 | elems->preq = pos; | ||
200 | elems->preq_len = elen; | ||
201 | break; | ||
202 | case WLAN_EID_PREP: | ||
203 | elems->prep = pos; | ||
204 | elems->prep_len = elen; | ||
205 | break; | ||
206 | case WLAN_EID_PERR: | ||
207 | elems->perr = pos; | ||
208 | elems->perr_len = elen; | ||
209 | break; | ||
210 | case WLAN_EID_CHANNEL_SWITCH: | ||
211 | elems->ch_switch_elem = pos; | ||
212 | elems->ch_switch_elem_len = elen; | ||
213 | break; | ||
214 | case WLAN_EID_QUIET: | ||
215 | if (!elems->quiet_elem) { | ||
216 | elems->quiet_elem = pos; | ||
217 | elems->quiet_elem_len = elen; | ||
218 | } | ||
219 | elems->num_of_quiet_elem++; | ||
220 | break; | ||
221 | case WLAN_EID_COUNTRY: | ||
222 | elems->country_elem = pos; | ||
223 | elems->country_elem_len = elen; | ||
224 | break; | ||
225 | case WLAN_EID_PWR_CONSTRAINT: | ||
226 | elems->pwr_constr_elem = pos; | ||
227 | elems->pwr_constr_elem_len = elen; | ||
228 | break; | ||
229 | default: | ||
230 | break; | ||
231 | } | ||
232 | |||
233 | left -= elen; | ||
234 | pos += elen; | ||
235 | } | ||
236 | } | ||
237 | |||
238 | |||
239 | static u8 * ieee80211_bss_get_ie(struct ieee80211_sta_bss *bss, u8 ie) | 94 | static u8 * ieee80211_bss_get_ie(struct ieee80211_sta_bss *bss, u8 ie) |
240 | { | 95 | { |
241 | u8 *end, *pos; | 96 | u8 *end, *pos; |