cli: fix resetting values via property alias
Property aliases should really just be shortcuts for one fully spelled out property (sometimes, they do more like "master"). Anyway, we must also handle resetting the value, otherwise: $ nmcli connection add type gsm apn "" will still result in "gsm.apn=internet", unlike $ nmcli connection add type gsm gsm.apn ""
This commit is contained in:
4
NEWS
4
NEWS
@@ -10,7 +10,9 @@ USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE!
|
|||||||
|
|
||||||
* Add an 'accept-all-mac-addresses' property to the ethernet setting
|
* Add an 'accept-all-mac-addresses' property to the ethernet setting
|
||||||
to accept frames with any MAC address (also known as promiscuous
|
to accept frames with any MAC address (also known as promiscuous
|
||||||
mode)
|
mode).
|
||||||
|
* nmcli: fix setting property aliases to empty value to reset the
|
||||||
|
default value.
|
||||||
|
|
||||||
=============================================
|
=============================================
|
||||||
NetworkManager-1.30
|
NetworkManager-1.30
|
||||||
|
@@ -4182,23 +4182,17 @@ set_option(NmCli * nmc,
|
|||||||
NULL);
|
NULL);
|
||||||
if (option && option->check_and_set) {
|
if (option && option->check_and_set) {
|
||||||
return option->check_and_set(nmc, connection, option, value, error);
|
return option->check_and_set(nmc, connection, option, value, error);
|
||||||
} else if (value) {
|
} else {
|
||||||
return set_property(nmc->client,
|
set_property(nmc->client,
|
||||||
connection,
|
connection,
|
||||||
setting_name,
|
setting_name,
|
||||||
property_name,
|
property_name,
|
||||||
value,
|
value,
|
||||||
inf_flags & NM_META_PROPERTY_INF_FLAG_MULTI
|
!value ? NM_META_ACCESSOR_MODIFIER_DEL
|
||||||
? NM_META_ACCESSOR_MODIFIER_ADD
|
: (inf_flags & NM_META_PROPERTY_INF_FLAG_MULTI
|
||||||
: NM_META_ACCESSOR_MODIFIER_SET,
|
? NM_META_ACCESSOR_MODIFIER_ADD
|
||||||
error);
|
: NM_META_ACCESSOR_MODIFIER_SET),
|
||||||
} else if (inf_flags & NM_META_PROPERTY_INF_FLAG_REQD) {
|
error);
|
||||||
g_set_error(error,
|
|
||||||
NMCLI_ERROR,
|
|
||||||
NMC_RESULT_ERROR_USER_INPUT,
|
|
||||||
_("Error: '%s' is mandatory."),
|
|
||||||
option_name);
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Reference in New Issue
Block a user