external/wpa_supplicant_6
Revision | 166cfe57f4db4547fac33befc25c4351b238bca1 (tree) |
---|---|
Zeit | 2011-07-11 16:13:11 |
Autor | Kelvie Wong <kelvie@ieee...> |
Commiter | Chih-Wei Huang |
Hackishly port szym's ad-hoc patch to work with my Xoom.
Taken from [1], I got rid of all of the #ifdefs to keep it clean; the (*)
prefix hack that he uses bugs up the UI a bit; you will see three entries
for your ad-hoc wireless point (and none of them will say remembered), but
at least it works until Google decides to add ad-hoc support.
[1]http://szym.net/android/adhoc-wpa-supp.html
Change-Id: I3f1845fa4a83b38348f0f07c63712962e26db1b6
Signed-off-by: Kelvie Wong <kelvie@ieee.org>
@@ -341,9 +341,14 @@ static int wpa_supplicant_ctrl_iface_status(struct wpa_supplicant *wpa_s, | ||
341 | 341 | ssid_len = _res; |
342 | 342 | _ssid = ssid_buf; |
343 | 343 | } |
344 | - ret = os_snprintf(pos, end - pos, "ssid=%s\nid=%d\n", | |
345 | - wpa_ssid_txt(_ssid, ssid_len), | |
344 | + if (ssid->mode == IEEE80211_MODE_IBSS) | |
345 | + ret = os_snprintf(pos, end - pos, "ssid=%s%s\nid=%d\n", | |
346 | + "(*)", wpa_ssid_txt(_ssid, ssid_len), | |
346 | 347 | ssid->id); |
348 | + else | |
349 | + ret = os_snprintf(pos, end - pos, "ssid=%s\nid=%d\n", | |
350 | + wpa_ssid_txt(_ssid, ssid_len), | |
351 | + ssid->id); | |
347 | 352 | if (ret < 0 || ret >= end - pos) |
348 | 353 | return pos - buf; |
349 | 354 | pos += ret; |
@@ -777,12 +782,7 @@ static int wpa_supplicant_ctrl_iface_scan_result( | ||
777 | 782 | return -1; |
778 | 783 | pos += ret; |
779 | 784 | } |
780 | - if (res->caps & IEEE80211_CAP_IBSS) { | |
781 | - ret = os_snprintf(pos, end - pos, "[IBSS]"); | |
782 | - if (ret < 0 || ret >= end - pos) | |
783 | - return -1; | |
784 | - pos += ret; | |
785 | - } | |
785 | + | |
786 | 786 | /* Just to make the fields line up nicely when printed */ |
787 | 787 | if (!ie && !ie2) { |
788 | 788 | ret = os_snprintf(pos, end - pos, "\t"); |
@@ -791,8 +791,13 @@ static int wpa_supplicant_ctrl_iface_scan_result( | ||
791 | 791 | pos += ret; |
792 | 792 | } |
793 | 793 | ie = wpa_scan_get_ie(res, WLAN_EID_SSID); |
794 | - ret = os_snprintf(pos, end - pos, "\t%s", | |
795 | - ie ? wpa_ssid_txt(ie + 2, ie[1]) : ""); | |
794 | + | |
795 | + if (res->caps & IEEE80211_CAP_IBSS) | |
796 | + ret = os_snprintf(pos, end - pos, "\t%s%s", "(*)", | |
797 | + wpa_ssid_txt(ie + 2, ie[1])); | |
798 | + else | |
799 | + ret = os_snprintf(pos, end - pos, "\t%s", | |
800 | + ie ? wpa_ssid_txt(ie + 2, ie[1]) : ""); | |
796 | 801 | if (ret < 0 || ret >= end - pos) |
797 | 802 | return -1; |
798 | 803 | pos += ret; |
@@ -1084,6 +1089,18 @@ static int wpa_supplicant_ctrl_iface_set_network( | ||
1084 | 1089 | "id=%d", id); |
1085 | 1090 | return -1; |
1086 | 1091 | } |
1092 | + if (os_strcmp(name, "ssid") == 0) { | |
1093 | + // check prefix | |
1094 | + if ((value[0] == '"') && (os_strncmp(value+1, "(*)", 3) == 0)) { | |
1095 | + if (wpa_config_set(ssid, "mode", "1", 0) < 0) { | |
1096 | + wpa_printf(MSG_DEBUG, "CTRL_IFACE: failed to set IBSS on '%s'", | |
1097 | + value); | |
1098 | + return -1; | |
1099 | + } | |
1100 | + value += 3; | |
1101 | + value[0] = '"'; | |
1102 | + } | |
1103 | + } | |
1087 | 1104 | |
1088 | 1105 | if (wpa_config_set(ssid, name, value, 0) < 0) { |
1089 | 1106 | wpa_printf(MSG_DEBUG, "CTRL_IFACE: Failed to set network " |
@@ -584,7 +584,8 @@ wpa_supplicant_select_bss_non_wpa(struct wpa_supplicant *wpa_s, | ||
584 | 584 | continue; |
585 | 585 | } |
586 | 586 | |
587 | - if (bss->caps & IEEE80211_CAP_IBSS) { | |
587 | + if (bss->caps & IEEE80211_CAP_IBSS | |
588 | + && ssid->mode != IEEE80211_MODE_IBSS) { | |
588 | 589 | wpa_printf(MSG_DEBUG, " skip - " |
589 | 590 | "IBSS (adhoc) network"); |
590 | 591 | continue; |