summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-03-09 10:55:41 +0100
committerThomas Haller <thaller@redhat.com>2023-03-21 15:58:40 +0100
commitb386381ffc9ab913c359edcaf2e0d53b040886c2 (patch)
tree8fa4c4d6b7b045f6edae04f6ef950c1502a84bdb
parent7d6c1a0f43da38a9e9b28d2ea71ddeb9dcdd8a60 (diff)
platform: add nm_platform_ip_route_get_pref_src() helper
-rw-r--r--src/libnm-platform/nm-platform.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libnm-platform/nm-platform.h b/src/libnm-platform/nm-platform.h
index 08a7716e39..4263b6479c 100644
--- a/src/libnm-platform/nm-platform.h
+++ b/src/libnm-platform/nm-platform.h
@@ -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,