diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2019-01-24 15:31:06 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2019-07-29 10:28:22 +0200 |
commit | f249956cf7e6fdcef0dc2dcb76ca938f9e3dff21 (patch) | |
tree | dd54c68f6ed35f839de55ea37c364538c91369ac | |
parent | 67797338702d6f0af88ed57888a63ba8b74c8675 (diff) | |
download | NetworkManager-f249956cf7e6fdcef0dc2dcb76ca938f9e3dff21.tar.gz |
supplicant-config: add support for joining a Mesh
-rw-r--r-- | src/supplicant/nm-supplicant-config.c | 14 | ||||
-rw-r--r-- | src/supplicant/nm-supplicant-settings-verify.c | 7 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/supplicant/nm-supplicant-config.c b/src/supplicant/nm-supplicant-config.c index 9873fc8111..806c087c8a 100644 --- a/src/supplicant/nm-supplicant-config.c +++ b/src/supplicant/nm-supplicant-config.c @@ -458,7 +458,7 @@ nm_supplicant_config_add_setting_wireless (NMSupplicantConfig * self, GError **error) { NMSupplicantConfigPrivate *priv; - gboolean is_adhoc, is_ap; + gboolean is_adhoc, is_ap, is_mesh; const char *mode, *band; guint32 channel; GBytes *ssid; @@ -473,6 +473,7 @@ nm_supplicant_config_add_setting_wireless (NMSupplicantConfig * self, mode = nm_setting_wireless_get_mode (setting); is_adhoc = (mode && !strcmp (mode, "adhoc")) ? TRUE : FALSE; is_ap = (mode && !strcmp (mode, "ap")) ? TRUE : FALSE; + is_mesh = (mode && !strcmp (mode, "mesh")) ? TRUE : FALSE; if (is_adhoc || is_ap) priv->ap_scan = 2; else @@ -502,7 +503,12 @@ nm_supplicant_config_add_setting_wireless (NMSupplicantConfig * self, return FALSE; } - if ((is_adhoc || is_ap) && fixed_freq) { + if (is_mesh) { + if (!nm_supplicant_config_add_option (self, "mode", "5", -1, NULL, error)) + return FALSE; + } + + if ((is_adhoc || is_ap || is_mesh) && fixed_freq) { gs_free char *str_freq = NULL; str_freq = g_strdup_printf ("%u", fixed_freq); @@ -510,10 +516,10 @@ nm_supplicant_config_add_setting_wireless (NMSupplicantConfig * self, return FALSE; } - /* Except for Ad-Hoc and Hotspot, request that the driver probe for the + /* Except for Ad-Hoc, Hotspot and Mesh, request that the driver probe for the * specific SSID we want to associate with. */ - if (!(is_adhoc || is_ap)) { + if (!(is_adhoc || is_ap || is_mesh)) { if (!nm_supplicant_config_add_option (self, "scan_ssid", "1", -1, NULL, error)) return FALSE; } diff --git a/src/supplicant/nm-supplicant-settings-verify.c b/src/supplicant/nm-supplicant-settings-verify.c index 20466af1d0..1bd71320a4 100644 --- a/src/supplicant/nm-supplicant-settings-verify.c +++ b/src/supplicant/nm-supplicant-settings-verify.c @@ -93,7 +93,6 @@ static const struct Opt opt_table[] = { { "ssid", TYPE_BYTES, 0, 32,FALSE, NULL }, { "bssid", TYPE_KEYWORD, 0, 0, FALSE, NULL }, { "scan_ssid", TYPE_INT, 0, 1, FALSE, NULL }, - { "mode", TYPE_INT, 0, 2, FALSE, NULL }, { "frequency", TYPE_INT, 2412, 5825, FALSE, NULL }, { "auth_alg", TYPE_KEYWORD, 0, 0, FALSE, auth_alg_allowed }, { "psk", TYPE_BYTES, 0, 0, FALSE, NULL }, @@ -254,6 +253,12 @@ nm_supplicant_settings_verify_setting (const char * key, g_return_val_if_fail (key != NULL, FALSE); g_return_val_if_fail (value != NULL, FALSE); + if (strcmp (key, "mode") == 0) { + if (strcmp (value, "1") && strcmp (value, "2") && strcmp (value, "5")) + return TYPE_INVALID; + return TYPE_INT; + } + for (i = 0; i < opt_count; i++) { if (strcmp (opt_table[i].key, key) != 0) continue; |