• 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

Revision4ec257729c0e5d2d9e7fedfc34d05d649391af5c (tree)
Zeit2011-11-28 17:45:05
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;
@@ -788,12 +793,7 @@ static int wpa_supplicant_ctrl_iface_scan_result(
788793 return -1;
789794 pos += ret;
790795 }
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+
797797 /* Just to make the fields line up nicely when printed */
798798 if (!ie && !ie2) {
799799 ret = os_snprintf(pos, end - pos, "\t");
@@ -802,8 +802,13 @@ static int wpa_supplicant_ctrl_iface_scan_result(
802802 pos += ret;
803803 }
804804 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]) : "");
807812 if (ret < 0 || ret >= end - pos)
808813 return -1;
809814 pos += ret;
@@ -1095,6 +1100,18 @@ static int wpa_supplicant_ctrl_iface_set_network(
10951100 "id=%d", id);
10961101 return -1;
10971102 }
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+ }
10981115
10991116 if (wpa_config_set(ssid, name, value, 0) < 0) {
11001117 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;