platform: fix handling size of "NMPlatformIP4Route.weight"

Fixes: 1bbdecf5e1 ('platform: manage ECMP routes')
This commit is contained in:
Thomas Haller 2023-11-28 12:37:01 +01:00 committed by Fernando Fernandez Mancera
parent ff5a820fda
commit 796fe4f8ed

View file

@ -8596,7 +8596,7 @@ nm_platform_ip4_rt_nexthop_hash_update(const NMPlatformIP4RtNextHop *obj,
gboolean for_id, gboolean for_id,
NMHashState *h) NMHashState *h)
{ {
guint8 w; guint16 w;
nm_assert(obj); nm_assert(obj);
@ -8651,7 +8651,7 @@ nm_platform_ip4_route_hash_update(const NMPlatformIP4Route *obj,
obj->ifindex, obj->ifindex,
nm_platform_ip4_route_get_n_nexthops(obj), nm_platform_ip4_route_get_n_nexthops(obj),
obj->gateway, obj->gateway,
(guint8) NM_MAX(obj->weight, 1u)); (guint16) NM_MAX(obj->weight, 1u));
} }
} }
break; break;
@ -8666,7 +8666,7 @@ nm_platform_ip4_route_hash_update(const NMPlatformIP4Route *obj,
obj->metric, obj->metric,
nm_platform_ip4_route_get_n_nexthops(obj), nm_platform_ip4_route_get_n_nexthops(obj),
obj->gateway, 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), nmp_utils_ip_config_source_round_trip_rtprot(obj->rt_source),
_ip_route_scope_inv_get_normalized(obj), _ip_route_scope_inv_get_normalized(obj),
obj->tos, obj->tos,
@ -8732,8 +8732,8 @@ nm_platform_ip4_rt_nexthop_cmp(const NMPlatformIP4RtNextHop *a,
const NMPlatformIP4RtNextHop *b, const NMPlatformIP4RtNextHop *b,
gboolean for_id) gboolean for_id)
{ {
guint8 w_a; guint16 w_a;
guint8 w_b; guint16 w_b;
/* Note that weight zero is not valid (in kernel). We thus treat /* Note that weight zero is not valid (in kernel). We thus treat
* weight zero usually the same as 1. * weight zero usually the same as 1.