Allow IBSS/AP mode networks to be created in ap_scan=1 mode
If no BSSes/IBSSes matching the enabled networks are found in the scan results, IBSS/AP mode network (if configured) can be created in ap_scan=1 mode instead of requiring ap_scan=2 mode to be used whenever using IBSS or AP mode.
This commit is contained in:
parent
09b9df4e4a
commit
b55aaa5fdf
2 changed files with 35 additions and 4 deletions
|
@ -697,6 +697,26 @@ static void wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static struct wpa_ssid *
|
||||||
|
wpa_supplicant_pick_new_network(struct wpa_supplicant *wpa_s)
|
||||||
|
{
|
||||||
|
int prio;
|
||||||
|
struct wpa_ssid *ssid;
|
||||||
|
|
||||||
|
for (prio = 0; prio < wpa_s->conf->num_prio; prio++) {
|
||||||
|
for (ssid = wpa_s->conf->pssid[prio]; ssid; ssid = ssid->pnext)
|
||||||
|
{
|
||||||
|
if (ssid->disabled)
|
||||||
|
continue;
|
||||||
|
if (ssid->mode == IEEE80211_MODE_IBSS ||
|
||||||
|
ssid->mode == IEEE80211_MODE_AP)
|
||||||
|
return ssid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s)
|
static void wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s)
|
||||||
{
|
{
|
||||||
struct wpa_scan_res *selected;
|
struct wpa_scan_res *selected;
|
||||||
|
@ -744,6 +764,11 @@ static void wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s)
|
||||||
wpa_supplicant_connect(wpa_s, selected, ssid);
|
wpa_supplicant_connect(wpa_s, selected, ssid);
|
||||||
} else {
|
} else {
|
||||||
wpa_printf(MSG_DEBUG, "No suitable network found");
|
wpa_printf(MSG_DEBUG, "No suitable network found");
|
||||||
|
ssid = wpa_supplicant_pick_new_network(wpa_s);
|
||||||
|
if (ssid) {
|
||||||
|
wpa_printf(MSG_DEBUG, "Setup a new network");
|
||||||
|
wpa_supplicant_associate(wpa_s, NULL, ssid);
|
||||||
|
} else
|
||||||
wpa_supplicant_req_new_scan(wpa_s, 5);
|
wpa_supplicant_req_new_scan(wpa_s, 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,9 @@ eapol_version=1
|
||||||
# allow the driver to take care of AP scanning and selection and use
|
# allow the driver to take care of AP scanning and selection and use
|
||||||
# wpa_supplicant just to process EAPOL frames based on IEEE 802.11 association
|
# wpa_supplicant just to process EAPOL frames based on IEEE 802.11 association
|
||||||
# information from the driver.
|
# information from the driver.
|
||||||
# 1: wpa_supplicant initiates scanning and AP selection
|
# 1: wpa_supplicant initiates scanning and AP selection; if no APs matching to
|
||||||
|
# the currently enabled networks are found, a new network (IBSS or AP mode
|
||||||
|
# operation) may be initialized (if configured) (default)
|
||||||
# 0: driver takes care of scanning, AP selection, and IEEE 802.11 association
|
# 0: driver takes care of scanning, AP selection, and IEEE 802.11 association
|
||||||
# parameters (e.g., WPA IE generation); this mode can also be used with
|
# parameters (e.g., WPA IE generation); this mode can also be used with
|
||||||
# non-WPA drivers when using IEEE 802.1X mode; do not try to associate with
|
# non-WPA drivers when using IEEE 802.1X mode; do not try to associate with
|
||||||
|
@ -102,6 +104,10 @@ eapol_version=1
|
||||||
# the driver reports successful association; each network block should have
|
# the driver reports successful association; each network block should have
|
||||||
# explicit security policy (i.e., only one option in the lists) for
|
# explicit security policy (i.e., only one option in the lists) for
|
||||||
# key_mgmt, pairwise, group, proto variables
|
# key_mgmt, pairwise, group, proto variables
|
||||||
|
# When using IBSS or AP mode, ap_scan=2 mode can force the new network to be
|
||||||
|
# created immediately regardless of scan results. ap_scan=1 mode will first try
|
||||||
|
# to scan for existing networks and only if no matches with the enabled
|
||||||
|
# networks are found, a new IBSS or AP mode network is created.
|
||||||
ap_scan=1
|
ap_scan=1
|
||||||
|
|
||||||
# EAP fast re-authentication
|
# EAP fast re-authentication
|
||||||
|
@ -244,8 +250,8 @@ fast_reauth=1
|
||||||
# 1 = IBSS (ad-hoc, peer-to-peer)
|
# 1 = IBSS (ad-hoc, peer-to-peer)
|
||||||
# 2 = AP (access point)
|
# 2 = AP (access point)
|
||||||
# Note: IBSS can only be used with key_mgmt NONE (plaintext and static WEP)
|
# Note: IBSS can only be used with key_mgmt NONE (plaintext and static WEP)
|
||||||
# and key_mgmt=WPA-NONE (fixed group key TKIP/CCMP). In addition, ap_scan has
|
# and key_mgmt=WPA-NONE (fixed group key TKIP/CCMP). WPA-None requires
|
||||||
# to be set to 2 for IBSS. WPA-None requires following network block options:
|
# following network block options:
|
||||||
# proto=WPA, key_mgmt=WPA-NONE, pairwise=NONE, group=TKIP (or CCMP, but not
|
# proto=WPA, key_mgmt=WPA-NONE, pairwise=NONE, group=TKIP (or CCMP, but not
|
||||||
# both), and psk must also be set.
|
# both), and psk must also be set.
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in a new issue