supplicant-config: add support for joining a Mesh

This commit is contained in:
Lubomir Rintel 2019-01-24 15:31:06 +01:00
parent 6779733870
commit f249956cf7
2 changed files with 16 additions and 5 deletions

View file

@ -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;
}

View file

@ -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;