summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-08-10 10:03:19 +0200
committerThomas Haller <thaller@redhat.com>2022-08-10 10:05:16 +0200
commit9f0f8e0fbece39c82e42b6b8fd6066b47bf1cfb8 (patch)
tree0b225adfc4208d06ee9874143761addd8a8353e4
parent6fb11dbe77ac11fa4c681a9f49c18d2b4193e007 (diff)
downloadNetworkManager-9f0f8e0fbece39c82e42b6b8fd6066b47bf1cfb8.tar.gz
config: support hex and octal numbers in nm_config_data_get_connection_default_int64()
This affects parsing global connection defaults from "NetworkManager.conf". Let's use a zero base for strtoll(), which honors the prefixes "0x" and "0" to use hex and octal numbers, respectively. Otherwise it uses decimal (base 10). This causes very little ambiguity, but it makes certain numbers just work. Also, we have flags properties, where it makes much more sense to write them in hex, like `connection.mptcp-flags=0x52`.
-rw-r--r--src/core/nm-config-data.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/nm-config-data.c b/src/core/nm-config-data.c
index 7e9364b6b5..0f512e3865 100644
--- a/src/core/nm-config-data.c
+++ b/src/core/nm-config-data.c
@@ -1688,7 +1688,7 @@ nm_config_data_get_connection_default_int64(const NMConfigData *self,
const char *value;
value = nm_config_data_get_connection_default(self, property, device);
- return _nm_utils_ascii_str_to_int64(value, 10, min, max, fallback);
+ return _nm_utils_ascii_str_to_int64(value, 0, min, max, fallback);
}
static const char *