external/wpa_supplicant_6
Revision | 4ec257729c0e5d2d9e7fedfc34d05d649391af5c (tree) |
---|---|
Zeit | 2011-11-28 17:45:05 |
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; |
@@ -788,12 +793,7 @@ static int wpa_supplicant_ctrl_iface_scan_result( | ||
788 | 793 | return -1; |
789 | 794 | pos += ret; |
790 | 795 | } |
791 | - if (res->caps & IEEE80211_CAP_IBSS) { | |
792 | - ret = os_snprintf(pos, end - pos, "[IBSS]"); | |
793 | - if (ret < 0 || ret >= end - pos) | |
794 | - return -1; | |
795 | - pos += ret; | |
796 | - } | |
796 | + | |
797 | 797 | /* Just to make the fields line up nicely when printed */ |
798 | 798 | if (!ie && !ie2) { |
799 | 799 | ret = os_snprintf(pos, end - pos, "\t"); |
@@ -802,8 +802,13 @@ static int wpa_supplicant_ctrl_iface_scan_result( | ||
802 | 802 | pos += ret; |
803 | 803 | } |
804 | 804 | ie = wpa_scan_get_ie(res, WLAN_EID_SSID); |
805 | - ret = os_snprintf(pos, end - pos, "\t%s", | |
806 | - ie ? wpa_ssid_txt(ie + 2, ie[1]) : ""); | |
805 | + | |
806 | + if (res->caps & IEEE80211_CAP_IBSS) | |
807 | + ret = os_snprintf(pos, end - pos, "\t%s%s", "(*)", | |
808 | + wpa_ssid_txt(ie + 2, ie[1])); | |
809 | + else | |
810 | + ret = os_snprintf(pos, end - pos, "\t%s", | |
811 | + ie ? wpa_ssid_txt(ie + 2, ie[1]) : ""); | |
807 | 812 | if (ret < 0 || ret >= end - pos) |
808 | 813 | return -1; |
809 | 814 | pos += ret; |
@@ -1095,6 +1100,18 @@ static int wpa_supplicant_ctrl_iface_set_network( | ||
1095 | 1100 | "id=%d", id); |
1096 | 1101 | return -1; |
1097 | 1102 | } |
1103 | + if (os_strcmp(name, "ssid") == 0) { | |
1104 | + // check prefix | |
1105 | + if ((value[0] == '"') && (os_strncmp(value+1, "(*)", 3) == 0)) { | |
1106 | + if (wpa_config_set(ssid, "mode", "1", 0) < 0) { | |
1107 | + wpa_printf(MSG_DEBUG, "CTRL_IFACE: failed to set IBSS on '%s'", | |
1108 | + value); | |
1109 | + return -1; | |
1110 | + } | |
1111 | + value += 3; | |
1112 | + value[0] = '"'; | |
1113 | + } | |
1114 | + } | |
1098 | 1115 | |
1099 | 1116 | if (wpa_config_set(ssid, name, value, 0) < 0) { |
1100 | 1117 | 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; |