Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
openwrt-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Feed
openwrt-core
Commits
b385c9ca
Commit
b385c9ca
authored
1 year ago
by
Pavel Martynov
Committed by
Janusz Dziedzic
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
airoha: re-connect wpa_supplicant to hostapd if connectivity is lost
parent
bf6e8e95
No related branches found
Branches containing commit
No related tags found
1 merge request
!541
airoha: re-connect wpa_supplicant to hostapd if connectivity is lost
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
package/network/services/hostapd/patches/99947-supplicant-wpa-ctrl-reconnect.patch
+103
-0
103 additions, 0 deletions
...hostapd/patches/99947-supplicant-wpa-ctrl-reconnect.patch
with
103 additions
and
0 deletions
package/network/services/hostapd/patches/99947-supplicant-wpa-ctrl-reconnect.patch
0 → 100644
+
103
−
0
View file @
b385c9ca
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index b9ebd22..f6d8b11 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -5015,7 +5015,8 @@
supplicant_ch_switch_started(struct wpa_supplicant *wpa_s,
data->ch_switch.cf1,
data->ch_switch.cf2,
width);
- ret = wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL);
+
+ ret = wpa_supplicant_ctrl_request(wpa_s, cmd, os_strlen(cmd), buf, &len, NULL);
free(cmd);
if (ret < 0)
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 0f81873..e1dc976 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -139,7 +139,7 @@
int hostapd_stop(struct wpa_supplicant *wpa_s)
wpa_msg(wpa_s, MSG_ERROR, "stop hostapd AP interfaces");
- if (wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL) < 0) {
+ if (wpa_supplicant_ctrl_request(wpa_s, cmd, os_strlen(cmd), buf, &len, NULL) < 0) {
wpa_printf(MSG_ERROR, "\nFailed to stop hostapd AP interfaces\n");
return -1;
}
@@ -185,7 +185,7 @@
static int hostapd_reload(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
hw_mode, op_class) < 0)
return -1;
- ret = wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL);
+ ret = wpa_supplicant_ctrl_request(wpa_s, cmd, os_strlen(cmd), buf, &len, NULL);
free(cmd);
if (ret < 0) {
@@ -5799,6 +5799,28 @@
void wpa_supplicant_apply_ht_overrides(
#endif /* CONFIG_HT_OVERRIDES */
+#define WPAS_REQUEST_ATTEMPTS 16
+int wpa_supplicant_ctrl_request(struct wpa_supplicant *wpa_s,
+ const char *cmd, size_t cmd_len,
+ char *reply, size_t *reply_len,
+ void (*msg_cb)(char *msg, size_t len))
+{
+ int i;
+
+ for (i = 0; i < WPAS_REQUEST_ATTEMPTS; i++)
+ {
+ int ret = wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), reply, reply_len, NULL);
+ if (!ret)
+ return ret;
+
+ wpa_printf(MSG_ERROR, "Command (\"%s\") failed - Retry", cmd);
+ wpa_ctrl_close(wpa_s->hostapd);
+ wpa_s->hostapd = wpa_ctrl_open(wpa_s->hostapd_ctrl_path);
+ }
+
+ return -1;
+}
+#undef WPAS_REQUEST_ATTEMPTS
#ifdef CONFIG_VHT_OVERRIDES
void wpa_supplicant_apply_vht_overrides(
@@ -6777,6 +6799,7 @@
static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s,
}
if (iface->hostapd_ctrl) {
+ wpa_s->hostapd_ctrl_path = os_strdup(iface->hostapd_ctrl);
wpa_s->hostapd = wpa_ctrl_open(iface->hostapd_ctrl);
if (!wpa_s->hostapd) {
wpa_printf(MSG_ERROR, "\nFailed to connect to hostapd\n");
@@ -7146,6 +7169,7 @@
static void wpa_supplicant_deinit_iface(struct wpa_supplicant *wpa_s,
os_free(wpa_s->ssids_from_scan_req);
os_free(wpa_s->last_scan_freqs);
+ os_free(wpa_s->hostapd_ctrl_path);
os_free(wpa_s);
}
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index e11b454..6c3288f 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -1564,6 +1564,8 @@
struct wpa_supplicant {
unsigned int enable_dscp_policy_capa:1;
unsigned int connection_dscp:1;
unsigned int wait_for_dscp_req:1;
+
+ const char *hostapd_ctrl_path;
};
@@ -1935,4 +1937,8 @@
int wpas_pasn_auth_rx(struct wpa_supplicant *wpa_s,
int wpas_pasn_deauthenticate(struct wpa_supplicant *wpa_s, const u8 *bssid);
+int wpa_supplicant_ctrl_request(struct wpa_supplicant *wpa_s, const char *cmd,
+ size_t cmd_len, char *reply, size_t *reply_len,
+ void (*msg_cb)(char *msg, size_t len));
+
#endif /* WPA_SUPPLICANT_I_H */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment