]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
mesh: Make NL80211_MESHCONF_RSSI_THRESHOLD configurable
authorMasashi Honma <masashi.honma@gmail.com>
Mon, 3 Apr 2017 22:28:35 +0000 (07:28 +0900)
committerJouni Malinen <j@w1.fi>
Mon, 8 May 2017 13:23:02 +0000 (16:23 +0300)
In some practical cases, it is useful to suppress joining to node in the
distance. The new field mesh_rssi_threshold could be used as RSSI
threshold for joining.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
src/drivers/driver.h
src/drivers/driver_nl80211.c
wpa_supplicant/config.c
wpa_supplicant/config_file.c
wpa_supplicant/config_ssid.h
wpa_supplicant/mesh.c
wpa_supplicant/wpa_cli.c

index 014c7b7123e966b59f780e88ea3cbed21ceca88e..8103c28e4098c8cc78d92ef326131b2b0324047a 100644 (file)
@@ -1388,6 +1388,7 @@ struct wpa_driver_mesh_bss_params {
 #define WPA_DRIVER_MESH_CONF_FLAG_PEER_LINK_TIMEOUT    0x00000002
 #define WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS       0x00000004
 #define WPA_DRIVER_MESH_CONF_FLAG_HT_OP_MODE           0x00000008
+#define WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD       0x00000010
        /*
         * TODO: Other mesh configuration parameters would go here.
         * See NL80211_MESHCONF_* for all the mesh config parameters.
@@ -1396,6 +1397,7 @@ struct wpa_driver_mesh_bss_params {
        int auto_plinks;
        int peer_link_timeout;
        int max_peer_links;
+       int rssi_threshold;
        u16 ht_opmode;
 };
 
index 9f60504eb6cc34c9c7be64fac79009ccb4c27ec7..af1cb843d2ab3ad2a287aa63416b747dcbf65163 100644 (file)
@@ -8870,7 +8870,10 @@ static int nl80211_put_mesh_config(struct nl_msg *msg,
                         params->auto_plinks)) ||
            ((params->flags & WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS) &&
             nla_put_u16(msg, NL80211_MESHCONF_MAX_PEER_LINKS,
-                        params->max_peer_links)))
+                        params->max_peer_links)) ||
+           ((params->flags & WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD) &&
+            nla_put_u32(msg, NL80211_MESHCONF_RSSI_THRESHOLD,
+                        params->rssi_threshold)))
                return -1;
 
        /*
index 9ef11d86d88f3f2eadea3f5826c5f1aa1254213e..8a88a8dff301962a92ae80eaf320a39f5404254c 100644 (file)
@@ -2107,6 +2107,7 @@ static const struct parse_data ssid_fields[] = {
 #ifdef CONFIG_MESH
        { INT_RANGE(mode, 0, 5) },
        { INT_RANGE(no_auto_peer, 0, 1) },
+       { INT_RANGE(mesh_rssi_threshold, -255, 1) },
 #else /* CONFIG_MESH */
        { INT_RANGE(mode, 0, 4) },
 #endif /* CONFIG_MESH */
@@ -2639,6 +2640,7 @@ void wpa_config_set_network_defaults(struct wpa_ssid *ssid)
        ssid->dot11MeshRetryTimeout = DEFAULT_MESH_RETRY_TIMEOUT;
        ssid->dot11MeshConfirmTimeout = DEFAULT_MESH_CONFIRM_TIMEOUT;
        ssid->dot11MeshHoldingTimeout = DEFAULT_MESH_HOLDING_TIMEOUT;
+       ssid->mesh_rssi_threshold = DEFAULT_MESH_RSSI_THRESHOLD;
 #endif /* CONFIG_MESH */
 #ifdef CONFIG_HT_OVERRIDES
        ssid->disable_ht = DEFAULT_DISABLE_HT;
index 3a44c8a0df766041757333d5d1a4eed57b80e5a5..7069b1624e8713b5c511e1d49def1f266a063d38 100644 (file)
@@ -783,6 +783,7 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid)
 #endif /* IEEE8021X_EAPOL */
        INT(mode);
        INT(no_auto_peer);
+       INT_DEF(mesh_rssi_threshold, DEFAULT_MESH_RSSI_THRESHOLD);
        INT(frequency);
        INT(fixed_freq);
 #ifdef CONFIG_ACS
index 869165c89602c24ee85dbfefee2f64e13f10c90b..7153042f9db09be222e18407dad4e35c37b043c8 100644 (file)
@@ -28,6 +28,7 @@
 #define DEFAULT_MESH_RETRY_TIMEOUT 40
 #define DEFAULT_MESH_CONFIRM_TIMEOUT 40
 #define DEFAULT_MESH_HOLDING_TIMEOUT 40
+#define DEFAULT_MESH_RSSI_THRESHOLD 1 /* no change */
 #define DEFAULT_DISABLE_HT 0
 #define DEFAULT_DISABLE_HT40 0
 #define DEFAULT_DISABLE_SGI 0
@@ -807,6 +808,15 @@ struct wpa_ssid {
         */
        int no_auto_peer;
 
+       /**
+        * mesh_rssi_threshold - Set mesh parameter mesh_rssi_threshold (dBm)
+        *
+        * -255..-1 = threshold value in dBm
+        * 0 = not using RSSI threshold
+        * 1 = do not change driver default
+        */
+       int mesh_rssi_threshold;
+
        /**
         * wps_disabled - WPS disabled in AP mode
         *
index 01b657e33057e0728fbf0975078988d86247f889..c0c8f9131a4f494b29f4d5b64e7bd3bd617127da 100644 (file)
@@ -413,6 +413,10 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s,
        else if (wpa_s->conf->dtim_period > 0)
                params.dtim_period = wpa_s->conf->dtim_period;
        params.conf.max_peer_links = wpa_s->conf->max_peer_links;
+       if (ssid->mesh_rssi_threshold < DEFAULT_MESH_RSSI_THRESHOLD) {
+               params.conf.rssi_threshold = ssid->mesh_rssi_threshold;
+               params.conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD;
+       }
 
        if (ssid->key_mgmt & WPA_KEY_MGMT_SAE) {
                params.flags |= WPA_DRIVER_MESH_FLAG_SAE_AUTH;
index c5091b5de7db001f71df03811372b6678605b406..8278bd2f06b35d1e75f7de7da785db42ee1ed80c 100644 (file)
@@ -1392,7 +1392,7 @@ static const char *network_fields[] = {
        "eap_workaround", "pac_file", "fragment_size", "ocsp",
 #endif /* IEEE8021X_EAPOL */
 #ifdef CONFIG_MESH
-       "mode", "no_auto_peer",
+       "mode", "no_auto_peer", "mesh_rssi_threshold",
 #else /* CONFIG_MESH */
        "mode",
 #endif /* CONFIG_MESH */