mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-31 01:50:34 +02:00
platform: cleanup and renaming of nm_platform_address_flush() function
Rename to nm_platform_ip_address_flush(), it's more consistent with naming for other platform functions. Also, pass an address family argument. Sometimes I feel an option makes it clearer what the function does. Otherwise, from the name it's not clear which address families are affected. As an API, it feels more correct to me. We soon also get a nm_platform_ip_route_flush() function, which will look similar.
This commit is contained in:
parent
a738a3446b
commit
990a050aff
5 changed files with 20 additions and 7 deletions
|
|
@ -12202,7 +12202,7 @@ nm_device_cleanup (NMDevice *self, NMDeviceStateReason reason, CleanupType clean
|
|||
ifindex = nm_device_get_ip_ifindex (self);
|
||||
if (ifindex > 0) {
|
||||
nm_route_manager_route_flush (nm_netns_get_route_manager (priv->netns), ifindex);
|
||||
nm_platform_address_flush (nm_device_get_platform (self), ifindex);
|
||||
nm_platform_ip_address_flush (nm_device_get_platform (self), AF_UNSPEC, ifindex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1068,7 +1068,7 @@ deactivate_cleanup (NMModem *self, NMDevice *device)
|
|||
if (ifindex > 0) {
|
||||
nm_route_manager_route_flush (nm_netns_get_route_manager (nm_device_get_netns (device)),
|
||||
ifindex);
|
||||
nm_platform_address_flush (nm_device_get_platform (device), ifindex);
|
||||
nm_platform_ip_address_flush (nm_device_get_platform (device), AF_UNSPEC, ifindex);
|
||||
nm_platform_link_set_down (nm_device_get_platform (device), ifindex);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3461,12 +3461,23 @@ nm_platform_ip6_address_sync (NMPlatform *self,
|
|||
}
|
||||
|
||||
gboolean
|
||||
nm_platform_address_flush (NMPlatform *self, int ifindex)
|
||||
nm_platform_ip_address_flush (NMPlatform *self,
|
||||
int addr_family,
|
||||
int ifindex)
|
||||
{
|
||||
gboolean success = TRUE;
|
||||
|
||||
_CHECK_SELF (self, klass, FALSE);
|
||||
|
||||
return nm_platform_ip4_address_sync (self, ifindex, NULL)
|
||||
&& nm_platform_ip6_address_sync (self, ifindex, NULL, FALSE);
|
||||
nm_assert (NM_IN_SET (addr_family, AF_UNSPEC,
|
||||
AF_INET,
|
||||
AF_INET6));
|
||||
|
||||
if (NM_IN_SET (addr_family, AF_UNSPEC, AF_INET))
|
||||
success &= nm_platform_ip4_address_sync (self, ifindex, NULL);
|
||||
if (NM_IN_SET (addr_family, AF_UNSPEC, AF_INET6))
|
||||
success &= nm_platform_ip6_address_sync (self, ifindex, NULL, FALSE);
|
||||
return success;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -1113,7 +1113,9 @@ gboolean nm_platform_ip4_address_delete (NMPlatform *self, int ifindex, in_addr_
|
|||
gboolean nm_platform_ip6_address_delete (NMPlatform *self, int ifindex, struct in6_addr address, guint8 plen);
|
||||
gboolean nm_platform_ip4_address_sync (NMPlatform *self, int ifindex, GPtrArray *known_addresse);
|
||||
gboolean nm_platform_ip6_address_sync (NMPlatform *self, int ifindex, const GPtrArray *known_addresses, gboolean keep_link_local);
|
||||
gboolean nm_platform_address_flush (NMPlatform *self, int ifindex);
|
||||
gboolean nm_platform_ip_address_flush (NMPlatform *self,
|
||||
int addr_family,
|
||||
int ifindex);
|
||||
|
||||
gboolean nm_platform_ip_route_add (NMPlatform *self,
|
||||
NMPNlmFlags flags,
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@ vpn_cleanup (NMVpnConnection *self, NMDevice *parent_dev)
|
|||
if (priv->ip_ifindex) {
|
||||
nm_platform_link_set_down (nm_netns_get_platform (priv->netns), priv->ip_ifindex);
|
||||
nm_route_manager_route_flush (nm_netns_get_route_manager (priv->netns), priv->ip_ifindex);
|
||||
nm_platform_address_flush (nm_netns_get_platform (priv->netns), priv->ip_ifindex);
|
||||
nm_platform_ip_address_flush (nm_netns_get_platform (priv->netns), AF_UNSPEC, priv->ip_ifindex);
|
||||
}
|
||||
|
||||
remove_parent_device_config (self, parent_dev);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue