Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] ieee80211: Use IWEVGENIE to set WPA IE

It replaces returning WPA/RSN IEs as custom events with returning them
as IWEVGENIE events. I have tested that it returns proper information
with both Xsupplicant, and the latest development version of the Linux
wireless tools.

Signed-off-by: Chris Hessing <Chris.Hessing@utah.edu>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Zhu Yi and committed by
John W. Linville
47168082 2c0f6316

+10 -22
+10 -22
net/ieee80211/ieee80211_wx.c
··· 193 193 if (iwe.u.data.length) 194 194 start = iwe_stream_add_point(start, stop, &iwe, custom); 195 195 196 + memset(&iwe, 0, sizeof(iwe)); 196 197 if (network->wpa_ie_len) { 197 - char buf[MAX_WPA_IE_LEN * 2 + 30]; 198 - 199 - u8 *p = buf; 200 - p += sprintf(p, "wpa_ie="); 201 - for (i = 0; i < network->wpa_ie_len; i++) { 202 - p += sprintf(p, "%02x", network->wpa_ie[i]); 203 - } 204 - 205 - memset(&iwe, 0, sizeof(iwe)); 206 - iwe.cmd = IWEVCUSTOM; 207 - iwe.u.data.length = strlen(buf); 198 + char buf[MAX_WPA_IE_LEN]; 199 + memcpy(buf, network->wpa_ie, network->wpa_ie_len); 200 + iwe.cmd = IWEVGENIE; 201 + iwe.u.data.length = network->wpa_ie_len; 208 202 start = iwe_stream_add_point(start, stop, &iwe, buf); 209 203 } 210 204 205 + memset(&iwe, 0, sizeof(iwe)); 211 206 if (network->rsn_ie_len) { 212 - char buf[MAX_WPA_IE_LEN * 2 + 30]; 213 - 214 - u8 *p = buf; 215 - p += sprintf(p, "rsn_ie="); 216 - for (i = 0; i < network->rsn_ie_len; i++) { 217 - p += sprintf(p, "%02x", network->rsn_ie[i]); 218 - } 219 - 220 - memset(&iwe, 0, sizeof(iwe)); 221 - iwe.cmd = IWEVCUSTOM; 222 - iwe.u.data.length = strlen(buf); 207 + char buf[MAX_WPA_IE_LEN]; 208 + memcpy(buf, network->rsn_ie, network->rsn_ie_len); 209 + iwe.cmd = IWEVGENIE; 210 + iwe.u.data.length = network->rsn_ie_len; 223 211 start = iwe_stream_add_point(start, stop, &iwe, buf); 224 212 } 225 213