diff options
-rw-r--r-- | src/platform/nm-platform.c | 34 | ||||
-rw-r--r-- | src/platform/nm-platform.h | 5 |
2 files changed, 39 insertions, 0 deletions
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index 4f0ab9ac44..9cc2e15d05 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -3451,6 +3451,40 @@ nm_platform_address_flush (NMPlatform *self, int ifindex) && nm_platform_ip6_address_sync (self, ifindex, NULL, FALSE); } +void +nm_platform_ip_route_sync (NMPlatform *self, + int addr_family, + int ifindex, + GPtrArray *routes) +{ + guint i; + gs_unref_ptrarray GPtrArray *plat_routes = NULL; + + nm_assert (NM_IS_PLATFORM (self)); + nm_assert (NM_IN_SET (addr_family, AF_INET, AF_INET6)); + nm_assert (ifindex > 0); + nm_assert ( !routes + || ({ + gboolean valid = TRUE; + for (i = 0; i < routes->len; i++) { + NMPObjectType t = NMP_OBJECT_GET_TYPE (routes->pdata[i]); + if (addr_family == AF_INET) + valid &= (t == NMP_OBJECT_TYPE_IP4_ROUTE); + else + valid &= (t == NMP_OBJECT_TYPE_IP4_ROUTE); + } + valid; + })); + + plat_routes = nm_platform_lookup_addrroute_clone (self, + addr_family == AF_INET + ? NMP_OBJECT_TYPE_IP4_ROUTE + : NMP_OBJECT_TYPE_IP6_ROUTE, + ifindex, + NULL, + NULL); +} + /*****************************************************************************/ NM_UTILS_LOOKUP_STR_DEFINE_STATIC (_nmp_nlm_flag_to_string_lookup, NMPNlmFlags, diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index 841c5e77a7..dcb082d927 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -1102,6 +1102,11 @@ gboolean nm_platform_ip6_route_add (NMPlatform *self, NMPNlmFlags flags, const N gboolean nm_platform_ip_route_delete (NMPlatform *self, const NMPObject *route); +void nm_platform_ip_route_sync (NMPlatform *self, + int addr_family, + int ifindex, + GPtrArray *routes); + const char *nm_platform_link_to_string (const NMPlatformLink *link, char *buf, gsize len); const char *nm_platform_lnk_gre_to_string (const NMPlatformLnkGre *lnk, char *buf, gsize len); const char *nm_platform_lnk_infiniband_to_string (const NMPlatformLnkInfiniband *lnk, char *buf, gsize len); |