summaryrefslogtreecommitdiff
path: root/src/core/NetworkManagerUtils.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2021-08-06 15:17:05 +0200
committerThomas Haller <thaller@redhat.com>2021-08-24 10:19:39 +0200
commita5a62a80fc6943379872e45386117a520aacbf4c (patch)
treeec6fd43821cfccd10eb76c4dc0331f56c85ab750 /src/core/NetworkManagerUtils.c
parent1a3a229bc86e7581494ef541f4d08799a0464406 (diff)
downloadNetworkManager-next2.tar.gz
core: use NML3ConfigData (WIP)next2
Diffstat (limited to 'src/core/NetworkManagerUtils.c')
-rw-r--r--src/core/NetworkManagerUtils.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/core/NetworkManagerUtils.c b/src/core/NetworkManagerUtils.c
index 04e7ef5500..a27adc3d29 100644
--- a/src/core/NetworkManagerUtils.c
+++ b/src/core/NetworkManagerUtils.c
@@ -1298,7 +1298,7 @@ void
nm_utils_ip_route_attribute_to_platform(int addr_family,
NMIPRoute * s_route,
NMPlatformIPRoute *r,
- guint32 route_table)
+ gint64 route_table)
{
GVariant * variant;
guint32 table;
@@ -1310,6 +1310,8 @@ nm_utils_ip_route_attribute_to_platform(int addr_family,
nm_assert(s_route);
nm_assert_addr_family(addr_family);
nm_assert(r);
+ nm_assert(route_table >= -1);
+ nm_assert(route_table <= (gint64) G_MAXUINT32);
#define GET_ATTR(name, dst, variant_type, type, dflt) \
G_STMT_START \
@@ -1336,10 +1338,16 @@ nm_utils_ip_route_attribute_to_platform(int addr_family,
GET_ATTR(NM_IP_ROUTE_ATTRIBUTE_TABLE, table, UINT32, uint32, 0);
- if (!table && r->type_coerced == nm_platform_route_type_coerce(RTN_LOCAL))
+ if (table != 0)
+ r->table_coerced = nm_platform_route_table_coerce(table);
+ else if (r->type_coerced == nm_platform_route_type_coerce(RTN_LOCAL))
r->table_coerced = nm_platform_route_table_coerce(RT_TABLE_LOCAL);
+ else if (route_table == 0)
+ r->table_coerced = nm_platform_route_table_coerce(RT_TABLE_MAIN);
+ else if (route_table > 0)
+ r->table_coerced = nm_platform_route_table_coerce(route_table);
else
- r->table_coerced = nm_platform_route_table_coerce(table ?: (route_table ?: RT_TABLE_MAIN));
+ r->table_any = TRUE;
if (NM_IS_IPv4(addr_family)) {
guint8 scope;