platform: add nm_platform_ip_address_delete() helper

(cherry picked from commit a60a262574)
This commit is contained in:
Thomas Haller 2022-03-28 22:26:15 +02:00
parent c1682b2556
commit 0fc40735ab
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -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,