diff options
author | Thomas Haller <thaller@redhat.com> | 2022-03-28 22:26:15 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2022-04-29 17:26:17 +0200 |
commit | 264296868b32a93bdbb21246828c52a282a53d50 (patch) | |
tree | be74e19743e364f214692e8c2d2d0e33534c2adc | |
parent | d29393ffa6683861b755481c5dac4d13e651f9b7 (diff) | |
download | NetworkManager-264296868b32a93bdbb21246828c52a282a53d50.tar.gz |
platform: add nm_platform_ip_address_delete() helper
(cherry picked from commit a60a262574206976eacc405633c059e0f375f0a8)
(cherry picked from commit 0fc40735ab582f2ff9f319043d77d5f40253f103)
-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 6f5cd5248f..baa3967db0 100644 --- a/src/libnm-platform/nm-platform.h +++ b/src/libnm-platform/nm-platform.h @@ -2097,6 +2097,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, |