• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythonwindowsphpgamebathyscapheguic翻訳omegattwitterframeworkbtronvb.net計画中(planning stage)testdomarduinodirectxpreviewerゲームエンジン

external/wpa_supplicant_6


Commit MetaInfo

Revision166cfe57f4db4547fac33befc25c4351b238bca1 (tree)
Zeit2011-07-11 16:13:11
AutorKelvie Wong <kelvie@ieee...>
CommiterChih-Wei Huang

Log Message

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>

Ändern Zusammenfassung

Diff

--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -341,9 +341,14 @@ static int wpa_supplicant_ctrl_iface_status(struct wpa_supplicant *wpa_s,
341341 ssid_len = _res;
342342 _ssid = ssid_buf;
343343 }
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),
346347 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);
347352 if (ret < 0 || ret >= end - pos)
348353 return pos - buf;
349354 pos += ret;
@@ -777,12 +782,7 @@ static int wpa_supplicant_ctrl_iface_scan_result(
777782 return -1;
778783 pos += ret;
779784 }
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+
786786 /* Just to make the fields line up nicely when printed */
787787 if (!ie && !ie2) {
788788 ret = os_snprintf(pos, end - pos, "\t");
@@ -791,8 +791,13 @@ static int wpa_supplicant_ctrl_iface_scan_result(
791791 pos += ret;
792792 }
793793 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]) : "");
796801 if (ret < 0 || ret >= end - pos)
797802 return -1;
798803 pos += ret;
@@ -1084,6 +1089,18 @@ static int wpa_supplicant_ctrl_iface_set_network(
10841089 "id=%d", id);
10851090 return -1;
10861091 }
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+ }
10871104
10881105 if (wpa_config_set(ssid, name, value, 0) < 0) {
10891106 wpa_printf(MSG_DEBUG, "CTRL_IFACE: Failed to set network "
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -584,7 +584,8 @@ wpa_supplicant_select_bss_non_wpa(struct wpa_supplicant *wpa_s,
584584 continue;
585585 }
586586
587- if (bss->caps & IEEE80211_CAP_IBSS) {
587+ if (bss->caps & IEEE80211_CAP_IBSS
588+ && ssid->mode != IEEE80211_MODE_IBSS) {
588589 wpa_printf(MSG_DEBUG, " skip - "
589590 "IBSS (adhoc) network");
590591 continue;