diff options
author | Thomas Haller <thaller@redhat.com> | 2022-03-28 22:26:15 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2022-04-08 16:26:58 +0200 |
commit | 0fc40735ab582f2ff9f319043d77d5f40253f103 (patch) | |
tree | 4d97d14f5bb274b9bdc47650fa0538c6efdb7afa | |
parent | c1682b2556b5895b48215c7957173d4fc72530ed (diff) |
platform: add nm_platform_ip_address_delete() helper
(cherry picked from commit a60a262574206976eacc405633c059e0f375f0a8)
-rw-r--r-- | src/libnm-platform/nm-platform.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/libnm-platform/nm-platform.h b/src/libnm-platform/nm-platform.h index d20b9e5543..c6d6d6917a 100644 --- a/src/libnm-platform/nm-platform.h +++ b/src/libnm-platform/nm-platform.h @@ -2129,6 +2129,29 @@ gboolean nm_platform_ip4_address_delete(NMPlatform *self, gboolean nm_platform_ip6_address_delete(NMPlatform *self, int ifindex, struct in6_addr address, guint8 plen); +static inline gboolean +nm_platform_ip_address_delete(NMPlatform *self, + int addr_family, + int ifindex, + gconstpointer /* (const NMPlatformIPAddress *) */ addr) +{ + if (NM_IS_IPv4(addr_family)) { + const NMPlatformIP4Address *a = addr; + + if (ifindex <= 0) + ifindex = a->ifindex; + + return nm_platform_ip4_address_delete(self, ifindex, a->address, a->plen, a->peer_address); + } else { + const NMPlatformIP6Address *a = addr; + + if (ifindex <= 0) + ifindex = a->ifindex; + + return nm_platform_ip6_address_delete(self, ifindex, a->address, a->plen); + } +} + gboolean nm_platform_ip_address_sync(NMPlatform *self, int addr_family, int ifindex, |