[PATCH 3/4] mesh: Use WPA_DRIVER_MESH_CONF_FLAG_* as modification flag
Masashi Honma
masashi.honma at gmail.com
Mon Jul 18 19:03:57 PDT 2016
Signed-off-by: Masashi Honma <masashi.honma at gmail.com>
---
src/drivers/driver.h | 5 ++++-
src/drivers/driver_nl80211.c | 15 ++++++++++-----
wpa_supplicant/mesh.c | 4 ++--
3 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 3e59e6e..b0d25f0 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1118,12 +1118,15 @@ struct wpa_driver_ap_params {
};
struct wpa_driver_mesh_bss_params {
-#define WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS 0x00000001
+#define WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS 0x00000001
+#define WPA_DRIVER_MESH_CONF_FLAG_PEER_LINK_TIMEOUT 0x00000002
+#define WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS 0x00000004
/*
* TODO: Other mesh configuration parameters would go here.
* See NL80211_MESHCONF_* for all the mesh config parameters.
*/
unsigned int flags;
+ int auto_plinks;
int peer_link_timeout;
int max_peer_links;
};
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index d9d8c98..7d8330a 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -8386,12 +8386,13 @@ static int nl80211_put_mesh_config(struct nl_msg *msg,
if (!container)
return -1;
- if (nla_put_u32(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS,
- (params->flags & WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS) ?
- 1 : 0))
+ if ((params->flags & WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS) &&
+ nla_put_u32(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS,
+ params->auto_plinks))
return -1;
- if (nla_put_u16(msg, NL80211_MESHCONF_MAX_PEER_LINKS,
+ if ((params->flags & WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS) &&
+ nla_put_u16(msg, NL80211_MESHCONF_MAX_PEER_LINKS,
params->max_peer_links))
return -1;
@@ -8399,7 +8400,8 @@ static int nl80211_put_mesh_config(struct nl_msg *msg,
* Set NL80211_MESHCONF_PLINK_TIMEOUT even if user mpm is used because
* the timer could disconnect stations even in that case.
*/
- if (nla_put_u32(msg, NL80211_MESHCONF_PLINK_TIMEOUT,
+ if ((params->flags & WPA_DRIVER_MESH_CONF_FLAG_PEER_LINK_TIMEOUT) &&
+ nla_put_u32(msg, NL80211_MESHCONF_PLINK_TIMEOUT,
params->peer_link_timeout)) {
wpa_printf(MSG_ERROR, "nl80211: Failed to set PLINK_TIMEOUT");
return -1;
@@ -8454,6 +8456,9 @@ static int nl80211_join_mesh(struct i802_bss *bss,
goto fail;
nla_nest_end(msg, container);
+ params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS;
+ params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_PEER_LINK_TIMEOUT;
+ params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS;
if (nl80211_put_mesh_config(msg, ¶ms->conf) < 0)
goto fail;
diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c
index 7d42d4a..31a5fdf 100644
--- a/wpa_supplicant/mesh.c
+++ b/wpa_supplicant/mesh.c
@@ -410,10 +410,10 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s,
if (wpa_s->conf->user_mpm) {
params.flags |= WPA_DRIVER_MESH_FLAG_USER_MPM;
- params.conf.flags &= ~WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS;
+ params.conf.auto_plinks = 0;
} else {
params.flags |= WPA_DRIVER_MESH_FLAG_DRIVER_MPM;
- params.conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS;
+ params.conf.auto_plinks = 1;
}
params.conf.peer_link_timeout = wpa_s->conf->mesh_max_inactivity;
--
2.7.4
More information about the Hostap
mailing list