platform: add nm_platform_ip_route_get_gateway() helper

This commit is contained in:
Thomas Haller 2020-07-28 08:09:12 +02:00
parent 1e3f5b7c01
commit 7eb94b7dcc
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -1848,6 +1848,18 @@ gboolean nm_platform_ip_address_flush (NMPlatform *self,
void nm_platform_ip_route_normalize (int addr_family,
NMPlatformIPRoute *route);
static inline gconstpointer
nm_platform_ip_route_get_gateway (int addr_family,
const NMPlatformIPRoute *route)
{
nm_assert_addr_family (addr_family);
nm_assert (route);
if (NM_IS_IPv4 (addr_family))
return &((NMPlatformIP4Route *) route)->gateway;
return &((NMPlatformIP6Route *) route)->gateway;
}
int nm_platform_ip_route_add (NMPlatform *self,
NMPNlmFlags flags,
const NMPObject *route);