[PATCH 1/3]: add flags output to new bss ctrl interface command reply

Kel Modderman kel
Wed Jan 30 10:19:08 PST 2008


The flags as given by scan_results command are used by wpa_gui to make various
decisions. Also produce them in bss output.

Signed-off-by: Kel Modderman <kel at otaku42.de>
---
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -1230,7 +1230,7 @@
 	struct wpa_scan_res *bss;
 	int ret;
 	char *pos, *end;
-	const u8 *ie;
+	const u8 *ie, *ie2;
 
 	if (os_strcmp(cmd, "first") == 0) {
 		first = 1;
@@ -1294,6 +1294,35 @@
 		return pos - buf;
 	pos += ret;
 
+	ret = os_snprintf(pos, end - pos, "flags=");
+	if (ret < 0 || ret >= end - pos)
+		return pos - buf;
+	pos += ret;
+
+	ie = wpa_scan_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE);
+	if (ie)
+		pos = wpa_supplicant_ie_txt(pos, end, "WPA", ie, 2 + ie[1]);
+	ie2 = wpa_scan_get_ie(bss, WLAN_EID_RSN);
+	if (ie2)
+		pos = wpa_supplicant_ie_txt(pos, end, "WPA2", ie2, 2 + ie2[1]);
+	if (!ie && !ie2 && bss->caps & IEEE80211_CAP_PRIVACY) {
+		ret = os_snprintf(pos, end - pos, "[WEP]");
+		if (ret < 0 || ret >= end - pos)
+			return pos - buf;
+		pos += ret;
+	}
+	if (bss->caps & IEEE80211_CAP_IBSS) {
+		ret = os_snprintf(pos, end - pos, "[IBSS]");
+		if (ret < 0 || ret >= end - pos)
+			return pos - buf;
+		pos += ret;
+	}
+
+	ret = snprintf(pos, end - pos, "\n");
+	if (ret < 0 || ret >= end - pos)
+		return pos - buf;
+	pos += ret;
+
 	ie = wpa_scan_get_ie(bss, WLAN_EID_SSID);
 	ret = os_snprintf(pos, end - pos, "ssid=%s\n",
 			  ie ? wpa_ssid_txt(ie + 2, ie[1]) : "");
---



More information about the Hostap mailing list