From cdf17af6579a6ddebc1a76affbfa756432bc6bfa Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Wed, 28 Jan 2015 12:00:00 +0100 Subject: [PATCH] ip6-config: remove the link-local address on address flush If it stays after device dispose a connection is assumed. https://bugzilla.redhat.com/show_bug.cgi?id=1184997 (cherry picked from commit 6771f836ce3518bc75f0cbbed74138f40c890f7d) --- src/nm-ip6-config.c | 2 +- src/platform/nm-platform.c | 7 ++++--- src/platform/nm-platform.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c index db64e72..63b4260 100644 --- a/src/nm-ip6-config.c +++ b/src/nm-ip6-config.c @@ -375,7 +375,7 @@ nm_ip6_config_commit (const NMIP6Config *config, int ifindex) g_return_val_if_fail (config != NULL, FALSE); /* Addresses */ - nm_platform_ip6_address_sync (ifindex, priv->addresses); + nm_platform_ip6_address_sync (ifindex, priv->addresses, TRUE); /* Routes */ { diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index 14fc44c..f679fe5 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -1826,6 +1826,7 @@ nm_platform_ip4_address_sync (int ifindex, const GArray *known_addresses, guint3 * nm_platform_ip6_address_sync: * @ifindex: Interface index * @known_addresses: List of addresses + * @keep_link_local: Don't remove link-local address * * A convenience function to synchronize addresses for a specific interface * with the least possible disturbance. It simply removes addresses that are @@ -1834,7 +1835,7 @@ nm_platform_ip4_address_sync (int ifindex, const GArray *known_addresses, guint3 * Returns: %TRUE on success. */ gboolean -nm_platform_ip6_address_sync (int ifindex, const GArray *known_addresses) +nm_platform_ip6_address_sync (int ifindex, const GArray *known_addresses, gboolean keep_link_local) { GArray *addresses; NMPlatformIP6Address *address; @@ -1847,7 +1848,7 @@ nm_platform_ip6_address_sync (int ifindex, const GArray *known_addresses) address = &g_array_index (addresses, NMPlatformIP6Address, i); /* Leave link local address management to the kernel */ - if (IN6_IS_ADDR_LINKLOCAL (&address->address)) + if (keep_link_local && IN6_IS_ADDR_LINKLOCAL (&address->address)) continue; if (!array_contains_ip6_address (known_addresses, address)) @@ -1880,7 +1881,7 @@ gboolean nm_platform_address_flush (int ifindex) { return nm_platform_ip4_address_sync (ifindex, NULL, 0) - && nm_platform_ip6_address_sync (ifindex, NULL); + && nm_platform_ip6_address_sync (ifindex, NULL, FALSE); } /******************************************************************/ diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index 3f37ed6..62eb0f4 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -572,7 +572,7 @@ gboolean nm_platform_ip6_address_delete (int ifindex, struct in6_addr address, i gboolean nm_platform_ip4_address_exists (int ifindex, in_addr_t address, int plen); gboolean nm_platform_ip6_address_exists (int ifindex, struct in6_addr address, int plen); gboolean nm_platform_ip4_address_sync (int ifindex, const GArray *known_addresses, guint32 device_route_metric); -gboolean nm_platform_ip6_address_sync (int ifindex, const GArray *known_addresses); +gboolean nm_platform_ip6_address_sync (int ifindex, const GArray *known_addresses, gboolean keep_link_local); gboolean nm_platform_address_flush (int ifindex); gboolean nm_platform_ip4_check_reinstall_device_route (int ifindex, const NMPlatformIP4Address *address, guint32 device_route_metric); -- 1.9.3