platform: add nm_platform_ip_route_get_pref_src() helper

This commit is contained in:
Thomas Haller 2023-03-09 10:55:41 +01:00
parent 7d6c1a0f43
commit b386381ffc
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -2306,6 +2306,19 @@ nm_platform_ip_route_get_gateway(int addr_family, const NMPlatformIPRoute *route
return &((NMPlatformIP6Route *) route)->gateway;
}
static inline gconstpointer
nm_platform_ip_route_get_pref_src(int addr_family, const NMPlatformIPRoute *route)
{
nm_assert_addr_family(addr_family);
if (!route)
return NULL;
if (NM_IS_IPv4(addr_family))
return &((NMPlatformIP4Route *) route)->pref_src;
return &((NMPlatformIP6Route *) route)->pref_src;
}
int nm_platform_ip_route_add(NMPlatform *self,
NMPNlmFlags flags,
const NMPObject *route,