From 9f0f8e0fbece39c82e42b6b8fd6066b47bf1cfb8 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 10 Aug 2022 10:03:19 +0200 Subject: [PATCH] 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`. --- src/core/nm-config-data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 *