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`.
This commit is contained in:
Thomas Haller 2022-08-10 10:03:19 +02:00
parent 6fb11dbe77
commit 9f0f8e0fbe
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

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