summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-11-28 12:37:01 +0100
committerFernando Fernandez Mancera <ffmancera@riseup.net>2023-11-28 14:22:18 +0000
commit796fe4f8ed5bdb4d024c4e60ee1934e17f12ce65 (patch)
tree679d91d49c70f40a0ed0acb4f890aad121b2ae8c
parentff5a820fda6a41d465f170f0845ad912421ec99d (diff)
platform: fix handling size of "NMPlatformIP4Route.weight"
Fixes: 1bbdecf5e125 ('platform: manage ECMP routes')
-rw-r--r--src/libnm-platform/nm-platform.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c
index a4751113da..f7aae1d850 100644
--- a/src/libnm-platform/nm-platform.c
+++ b/src/libnm-platform/nm-platform.c
@@ -8596,7 +8596,7 @@ nm_platform_ip4_rt_nexthop_hash_update(const NMPlatformIP4RtNextHop *obj,
gboolean for_id,
NMHashState *h)
{
- guint8 w;
+ guint16 w;
nm_assert(obj);
@@ -8651,7 +8651,7 @@ nm_platform_ip4_route_hash_update(const NMPlatformIP4Route *obj,
obj->ifindex,
nm_platform_ip4_route_get_n_nexthops(obj),
obj->gateway,
- (guint8) NM_MAX(obj->weight, 1u));
+ (guint16) NM_MAX(obj->weight, 1u));
}
}
break;
@@ -8666,7 +8666,7 @@ nm_platform_ip4_route_hash_update(const NMPlatformIP4Route *obj,
obj->metric,
nm_platform_ip4_route_get_n_nexthops(obj),
obj->gateway,
- (guint8) NM_MAX(obj->weight, 1u),
+ (guint16) NM_MAX(obj->weight, 1u),
nmp_utils_ip_config_source_round_trip_rtprot(obj->rt_source),
_ip_route_scope_inv_get_normalized(obj),
obj->tos,
@@ -8732,8 +8732,8 @@ nm_platform_ip4_rt_nexthop_cmp(const NMPlatformIP4RtNextHop *a,
const NMPlatformIP4RtNextHop *b,
gboolean for_id)
{
- guint8 w_a;
- guint8 w_b;
+ guint16 w_a;
+ guint16 w_b;
/* Note that weight zero is not valid (in kernel). We thus treat
* weight zero usually the same as 1.