X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=wpa_supplicant%2Fwifi_display.c;h=c363b21b92b160b5a6a12b41a9ec1cce94bf951c;hb=3388e7b96f1bd0c5e3b2a0d31ecfe3e7bd445d43;hp=6dc41dec077e0361cb14f6a05d72d6b91220baa0;hpb=4bd7e1614f3edd859c638aaba2d9db4485fe1bb8;p=mech_eap.git diff --git a/wpa_supplicant/wifi_display.c b/wpa_supplicant/wifi_display.c index 6dc41de..c363b21 100644 --- a/wpa_supplicant/wifi_display.c +++ b/wpa_supplicant/wifi_display.c @@ -233,15 +233,31 @@ int wifi_display_subelem_set(struct wpa_global *global, char *cmd) if (pos == NULL) return -1; *pos++ = '\0'; - subelem = atoi(cmd); - if (subelem < 0 || subelem >= MAX_WFD_SUBELEMS) - return -1; len = os_strlen(pos); if (len & 1) return -1; len /= 2; + if (os_strcmp(cmd, "all") == 0) { + int res; + + e = wpabuf_alloc(len); + if (e == NULL) + return -1; + if (hexstr2bin(pos, wpabuf_put(e, len), len) < 0) { + wpabuf_free(e); + return -1; + } + res = wifi_display_subelem_set_from_ies(global, e); + wpabuf_free(e); + return res; + } + + subelem = atoi(cmd); + if (subelem < 0 || subelem >= MAX_WFD_SUBELEMS) + return -1; + if (len == 0) { /* Clear subelement */ e = NULL; @@ -271,7 +287,7 @@ int wifi_display_subelem_set_from_ies(struct wpa_global *global, { int subelements[MAX_WFD_SUBELEMS] = {}; const u8 *pos, *end; - int len, subelem; + unsigned int len, subelem; struct wpabuf *e; wpa_printf(MSG_DEBUG, "WFD IEs set: %p - %lu", @@ -292,7 +308,7 @@ int wifi_display_subelem_set_from_ies(struct wpa_global *global, wpa_printf(MSG_DEBUG, "WFD Sub-Element ID %d - len %d", *pos, len - 3); - if (pos + len > end) + if (len > (unsigned int) (end - pos)) break; subelem = *pos; @@ -325,6 +341,19 @@ int wifi_display_subelem_get(struct wpa_global *global, char *cmd, { int subelem; + if (os_strcmp(cmd, "all") == 0) { + struct wpabuf *ie; + int res; + + ie = wifi_display_get_wfd_ie(global); + if (ie == NULL) + return 0; + res = wpa_snprintf_hex(buf, buflen, wpabuf_head(ie), + wpabuf_len(ie)); + wpabuf_free(ie); + return res; + } + subelem = atoi(cmd); if (subelem < 0 || subelem >= MAX_WFD_SUBELEMS) return -1;