aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/scan.c
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2013-01-15 13:53:35 -0800
committerDmitry Shmidt <dimitrysh@google.com>2013-01-15 14:44:44 -0800
commita54fa5fb807eaeff45464139b5a7759f060cec68 (patch)
tree4075cdcbf5dfca04f2593a53a3b43bb65aaef62b /wpa_supplicant/scan.c
parentd27fcf69aa1b0e5400526626b3ffdeacc21660b6 (diff)
downloadandroid_external_wpa_supplicant_8-a54fa5fb807eaeff45464139b5a7759f060cec68.tar.gz
android_external_wpa_supplicant_8-a54fa5fb807eaeff45464139b5a7759f060cec68.tar.bz2
android_external_wpa_supplicant_8-a54fa5fb807eaeff45464139b5a7759f060cec68.zip
Accumulative patch from commit dc013f1e37df3462085cf01a13f0c432f146ad7a
Author: Jouni Malinen <jouni@qca.qualcomm.com> Date: Tue Jan 15 12:03:29 2013 +0200 eapol_test: Remove unnecessary header file inclusion - P2P: Send P2P-FIND-STOPPED event in the new continue-search states - P2P: Add some more details on Service Query TLV format - P2P: Use the same Dialog Token value for every GO Negotiation retry - P2P: Publish more connected clients info in Probe Response frames - P2P: Fix some memory leaks in p2p_add_device() - P2P: Use the same Dialog Token value for every PD retry - P2P: Document operating channel selection functions - P2P: Always re-select operating channel if not hard coded - P2P: Do not allow re-selection of GO channel if forced_freq in use - P2P: Set FORCE_FREQ flag as part of p2p_prepare_channel() - P2P: Share a single function for GO channel selection - P2P: Prefer operating channels where HT40 is possible - P2P: Be more careful with wpa_config_update_psk() call - P2P: Allow PSK to be used instead of passphrase for persistent GO - P2P: Consider age for the P2P scan results - Move some P2P offchannel operations to offchannel.c - P2P: Add more complete description of p2p_cancel - P2P: Allow p2p_cancel to be used to stop p2p_connect-join operation - Interworking changes - WNM changes - WPS changes - SAE changes Change-Id: I38b847d3460066cc58aecbcf67266bfcff1d344e Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'wpa_supplicant/scan.c')
-rw-r--r--wpa_supplicant/scan.c112
1 files changed, 77 insertions, 35 deletions
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 048e6d01..c59b8bab 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -1,6 +1,6 @@
/*
* WPA Supplicant - Scanning
- * Copyright (c) 2003-2010, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2003-2012, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
@@ -81,6 +81,15 @@ static int wpas_wps_in_use(struct wpa_supplicant *wpa_s,
#endif /* CONFIG_WPS */
+/**
+ * wpa_supplicant_enabled_networks - Check whether there are enabled networks
+ * @wpa_s: Pointer to wpa_supplicant data
+ * Returns: 0 if no networks are enabled, >0 if networks are enabled
+ *
+ * This function is used to figure out whether any networks (or Interworking
+ * with enabled credentials and auto_interworking) are present in the current
+ * configuration.
+ */
int wpa_supplicant_enabled_networks(struct wpa_supplicant *wpa_s)
{
struct wpa_ssid *ssid = wpa_s->conf->ssid;
@@ -199,6 +208,12 @@ static void int_array_sort_unique(int *a)
}
+/**
+ * wpa_supplicant_trigger_scan - Request driver to start a scan
+ * @wpa_s: Pointer to wpa_supplicant data
+ * @params: Scan parameters
+ * Returns: 0 on success, -1 on failure
+ */
int wpa_supplicant_trigger_scan(struct wpa_supplicant *wpa_s,
struct wpa_driver_scan_params *params)
{
@@ -861,6 +876,7 @@ void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec)
* @wpa_s: Pointer to wpa_supplicant data
* @sec: Number of seconds after which to scan
* @usec: Number of microseconds after which to scan
+ * Returns: 0 on success or -1 otherwise
*
* This function is used to schedule periodic scans for neighboring
* access points after the specified time.
@@ -882,6 +898,7 @@ int wpa_supplicant_delayed_sched_scan(struct wpa_supplicant *wpa_s,
/**
* wpa_supplicant_req_sched_scan - Start a periodic scheduled scan
* @wpa_s: Pointer to wpa_supplicant data
+ * Returns: 0 is sched_scan was started or -1 otherwise
*
* This function is used to schedule periodic scans for neighboring
* access points repeating the scan continuously.
@@ -1135,6 +1152,16 @@ void wpa_supplicant_cancel_sched_scan(struct wpa_supplicant *wpa_s)
}
+/**
+ * wpa_supplicant_notify_scanning - Indicate possible scan state change
+ * @wpa_s: Pointer to wpa_supplicant data
+ * @scanning: Whether scanning is currently in progress
+ *
+ * This function is to generate scanning notifycations. It is called whenever
+ * there may have been a change in scanning (scan started, completed, stopped).
+ * wpas_notify_scanning() is called whenever the scanning state changed from the
+ * previously notified state.
+ */
void wpa_supplicant_notify_scanning(struct wpa_supplicant *wpa_s,
int scanning)
{
@@ -1172,6 +1199,15 @@ static int wpa_scan_get_max_rate(const struct wpa_scan_res *res)
}
+/**
+ * wpa_scan_get_ie - Fetch a specified information element from a scan result
+ * @res: Scan result entry
+ * @ie: Information element identitifier (WLAN_EID_*)
+ * Returns: Pointer to the information element (id field) or %NULL if not found
+ *
+ * This function returns the first matching information element in the scan
+ * result.
+ */
const u8 * wpa_scan_get_ie(const struct wpa_scan_res *res, u8 ie)
{
const u8 *end, *pos;
@@ -1191,6 +1227,15 @@ const u8 * wpa_scan_get_ie(const struct wpa_scan_res *res, u8 ie)
}
+/**
+ * wpa_scan_get_vendor_ie - Fetch vendor information element from a scan result
+ * @res: Scan result entry
+ * @vendor_type: Vendor type (four octets starting the IE payload)
+ * Returns: Pointer to the information element (id field) or %NULL if not found
+ *
+ * This function returns the first matching information element in the scan
+ * result.
+ */
const u8 * wpa_scan_get_vendor_ie(const struct wpa_scan_res *res,
u32 vendor_type)
{
@@ -1212,6 +1257,16 @@ const u8 * wpa_scan_get_vendor_ie(const struct wpa_scan_res *res,
}
+/**
+ * wpa_scan_get_vendor_ie_multi - Fetch vendor IE data from a scan result
+ * @res: Scan result entry
+ * @vendor_type: Vendor type (four octets starting the IE payload)
+ * Returns: Pointer to the information element payload or %NULL if not found
+ *
+ * This function returns concatenated payload of possibly fragmented vendor
+ * specific information elements in the scan result. The caller is responsible
+ * for freeing the returned buffer.
+ */
struct wpabuf * wpa_scan_get_vendor_ie_multi(const struct wpa_scan_res *res,
u32 vendor_type)
{
@@ -1243,40 +1298,6 @@ struct wpabuf * wpa_scan_get_vendor_ie_multi(const struct wpa_scan_res *res,
}
-struct wpabuf * wpa_scan_get_vendor_ie_multi_beacon(
- const struct wpa_scan_res *res, u32 vendor_type)
-{
- struct wpabuf *buf;
- const u8 *end, *pos;
-
- if (res->beacon_ie_len == 0)
- return NULL;
- buf = wpabuf_alloc(res->beacon_ie_len);
- if (buf == NULL)
- return NULL;
-
- pos = (const u8 *) (res + 1);
- pos += res->ie_len;
- end = pos + res->beacon_ie_len;
-
- while (pos + 1 < end) {
- if (pos + 2 + pos[1] > end)
- break;
- if (pos[0] == WLAN_EID_VENDOR_SPECIFIC && pos[1] >= 4 &&
- vendor_type == WPA_GET_BE32(&pos[2]))
- wpabuf_put_data(buf, pos + 2 + 4, pos[1] - 4);
- pos += 2 + pos[1];
- }
-
- if (wpabuf_len(buf) == 0) {
- wpabuf_free(buf);
- buf = NULL;
- }
-
- return buf;
-}
-
-
/*
* Channels with a great SNR can operate at full rate. What is a great SNR?
* This doc https://supportforums.cisco.com/docs/DOC-12954 says, "the general
@@ -1440,6 +1461,15 @@ static void dump_scan_res(struct wpa_scan_results *scan_res)
}
+/**
+ * wpa_supplicant_filter_bssid_match - Is the specified BSSID allowed
+ * @wpa_s: Pointer to wpa_supplicant data
+ * @bssid: BSSID to check
+ * Returns: 0 if the BSSID is filtered or 1 if not
+ *
+ * This function is used to filter out specific BSSIDs from scan reslts mainly
+ * for testing purposes (SET bssid_filter ctrl_iface command).
+ */
int wpa_supplicant_filter_bssid_match(struct wpa_supplicant *wpa_s,
const u8 *bssid)
{
@@ -1531,6 +1561,18 @@ wpa_supplicant_get_scan_results(struct wpa_supplicant *wpa_s,
}
+/**
+ * wpa_supplicant_update_scan_results - Update scan results from the driver
+ * @wpa_s: Pointer to wpa_supplicant data
+ * Returns: 0 on success, -1 on failure
+ *
+ * This function updates the BSS table within wpa_supplicant based on the
+ * currently available scan results from the driver without requesting a new
+ * scan. This is used in cases where the driver indicates an association
+ * (including roaming within ESS) and wpa_supplicant does not yet have the
+ * needed information to complete the connection (e.g., to perform validation
+ * steps in 4-way handshake).
+ */
int wpa_supplicant_update_scan_results(struct wpa_supplicant *wpa_s)
{
struct wpa_scan_results *scan_res;