ifcfg-rh: fix writing/reading TOS for routes in hexadecimal

iproute2 expects TOS in hex.

This is a change in behavior.
This commit is contained in:
Thomas Haller 2017-08-02 07:15:11 +02:00
parent 9be9cab646
commit f5c800885b
2 changed files with 2 additions and 2 deletions

View file

@ -471,7 +471,7 @@ parse_route_options (NMIPRoute *route, int family, const char *line, GError **er
g_regex_match (regex, line, 0, &match_info);
if (g_match_info_matches (match_info)) {
gs_free char *str = g_match_info_fetch (match_info, 1);
gint64 num = _nm_utils_ascii_str_to_int64 (str, 0, 0, G_MAXUINT8, -1);
gint64 num = _nm_utils_ascii_str_to_int64 (str, 16, 0, G_MAXUINT8, -1);
if (num == -1) {
g_match_info_free (match_info);

View file

@ -1893,7 +1893,7 @@ get_route_attributes_string (NMIPRoute *route, int family)
} else if (strstr (names[i], "lock-")) {
/* handled above */
} else if (nm_streq (names[i], NM_IP_ROUTE_ATTRIBUTE_TOS)) {
g_string_append_printf (str, "%s %u", names[i], (unsigned) g_variant_get_byte (attr));
g_string_append_printf (str, "%s 0x%02x", names[i], (unsigned) g_variant_get_byte (attr));
} else if ( nm_streq (names[i], NM_IP_ROUTE_ATTRIBUTE_SRC)
|| nm_streq (names[i], NM_IP_ROUTE_ATTRIBUTE_FROM)) {
char *arg = nm_streq (names[i], NM_IP_ROUTE_ATTRIBUTE_SRC) ? "src" : "from";