summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2021-04-27 08:38:12 +0200
committerThomas Haller <thaller@redhat.com>2021-05-03 10:11:23 +0200
commit95932ab5777555d3f3c503b4aecb89686efbe186 (patch)
treebb9a7b147ca8a319447bc6ce40164ffaa8aae803
parent40032f4614153d1775744267302dd79287f73b84 (diff)
downloadNetworkManager-95932ab5777555d3f3c503b4aecb89686efbe186.tar.gz
cli: reset GSM's APN/username/password when setting auto-config
Otherwise, nmcli connection modify "$GSM_PROFILE" gsm.auto-config yes has no effect -- if APN/username/password is set.
-rw-r--r--src/libnmc-setting/nm-meta-setting-desc.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/libnmc-setting/nm-meta-setting-desc.c b/src/libnmc-setting/nm-meta-setting-desc.c
index 836e76d864..36e523422a 100644
--- a/src/libnmc-setting/nm-meta-setting-desc.c
+++ b/src/libnmc-setting/nm-meta-setting-desc.c
@@ -3101,6 +3101,28 @@ static gboolean _set_fcn_dcb_bool(ARGS_SET_FCN)
return TRUE;
}
+static gboolean _set_fcn_gsm_auto_config(ARGS_SET_FCN)
+{
+ if (!_set_fcn_gobject_bool_impl(property_info, setting, modifier, value, error))
+ return FALSE;
+
+ if (nm_setting_gsm_get_auto_config(NM_SETTING_GSM(setting))) {
+ /* the auto-config flag gets normalized to FALSE, if any of
+ * APN, username or password is set. Thus, setting auto-config
+ * needs us to reset those flags too. */
+ g_object_set(setting,
+ NM_SETTING_GSM_APN,
+ NULL,
+ NM_SETTING_GSM_USERNAME,
+ NULL,
+ NM_SETTING_GSM_PASSWORD,
+ NULL,
+ NULL);
+ }
+
+ return TRUE;
+}
+
static gboolean _set_fcn_gsm_sim_operator_id(ARGS_SET_FCN)
{
const char *p = value;
@@ -5640,7 +5662,11 @@ static const NMMetaPropertyInfo *const property_infos_ETHTOOL[] = {
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_GSM
static const NMMetaPropertyInfo *const property_infos_GSM[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_AUTO_CONFIG,
- .property_type = &_pt_gobject_bool,
+ .property_type = DEFINE_PROPERTY_TYPE (
+ .get_fcn = _get_fcn_gobject,
+ .set_fcn = _set_fcn_gsm_auto_config,
+ .complete_fcn = _complete_fcn_gobject_bool,
+ ),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_NUMBER,
.property_type = &_pt_gobject_string,