reconnect is like reassociate but it only actually performs
reassociation if the interface is in disconnected state.
This is useful for the environment where we want to
disable/enable
wireless at various times but would prefer not to wait for
each up/down
operation to complete.
There is a possibility of harmless "races" here,
where a disconnect command
would be recieved when the interface is already disconnected
-- nothing
happens (this is what we want - great!). However, if we were
to use
"reassociate" and we were to send that command
when the system was
already connected, we'd prefer for it not to actually
reassociate.
IOW, reconnect is effectively "reassociate only if
disconnected"
I'll happily take suggestions for better command naming
here.
Semantically I would expect a reconnect command to be
unconditional
(like reassociate is), but at the same time,
"reconnect" is nice because
it pairs nicely with "disconnect".
---
wpa_supplicant/ctrl_iface.c | 6 ++++++
wpa_supplicant/wpa_cli.c | 14 ++++++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/wpa_supplicant/ctrl_iface.c
b/wpa_supplicant/ctrl_iface.c
index 30ca369..ae17511 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
 -1225,6
+1225,12  char * wpa_supplicant_ctrl_iface_process(struct
wpa_supplicant *wpa_s,
wpa_s->disconnected = 0;
wpa_s->reassociate = 1;
wpa_supplicant_req_scan(wpa_s, 0, 0);
+ } else if (os_strcmp(buf, "RECONNECT") == 0) {
+ if (wpa_s->disconnected) {
+ wpa_s->disconnected = 0;
+ wpa_s->reassociate = 1;
+ wpa_supplicant_req_scan(wpa_s, 0, 0);
+ }
} else if (os_strncmp(buf, "PREAUTH ", 8) == 0)
{
if (wpa_supplicant_ctrl_iface_preauth(wpa_s, buf + 8))
reply_len = -1;
diff --git a/wpa_supplicant/wpa_cli.c
b/wpa_supplicant/wpa_cli.c
index a0e226a..4779a4c 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
 -120,8
+120,10  static const char *commands_help =
" list of variables when run without
arguments)n"
" get_network <network id> <variable> =
get network variablesn"
" save_config = save the current
configurationn"
-" disconnect = disconnect and wait for reassociate
command before "
-"connectingn"
+" disconnect = disconnect and wait for
reassociate/reconnect command beforen "
+" connectingn"
+" reconnect = like reassociate, but only takes effect
if already "
+"disconnectedn"
" scan = request new BSS scann"
" scan_results = get latest scan resultsn"
" get_capability
<eap/pairwise/group/key_mgmt/proto/auth_alg> = "
 -865,6
+867,13  static int wpa_cli_cmd_disconnect(struct wpa_ctrl
*ctrl, int argc,
}
+static int wpa_cli_cmd_reconnect(struct wpa_ctrl *ctrl, int
argc,
+ char *argv[])
+{
+ return wpa_ctrl_command(ctrl, "RECONNECT");
+}
+
+
static int wpa_cli_cmd_save_config(struct wpa_ctrl *ctrl,
int argc,
char *argv[])
{
 -1049,6
+1058,7  static struct wpa_cli_cmd wpa_cli_commands[] = {
{ "get_network", wpa_cli_cmd_get_network },
{ "save_config", wpa_cli_cmd_save_config },
{ "disconnect", wpa_cli_cmd_disconnect },
+ { "reconnect", wpa_cli_cmd_reconnect },
{ "scan", wpa_cli_cmd_scan },
{ "scan_results", wpa_cli_cmd_scan_results },
{ "get_capability", wpa_cli_cmd_get_capability
},
--
1.5.2.2
_______________________________________________
HostAP mailing list
HostAP shmoo.com
http:/
/lists.shmoo.com/mailman/listinfo/hostap
|