diff options
Diffstat (limited to 'src/core/NetworkManagerUtils.c')
-rw-r--r-- | src/core/NetworkManagerUtils.c | 14 |
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; |