platform: fix IPv6 address sync after for link local addresses

Since commit 78ed0a4a23 (device: add
IPv6 link local address via merge-and-apply) we handle also IPv6 link
local addresses like regular addresses. That is, we also add them during
merge-and-apply and sync them via nm_platform_ip6_address_sync().

ip6-address-sync loops over the platform addresses, to find which
addresses shall be deleted, and which shall be deleted in order to
fix the address order/priority. At that point, we must not ignore
link-local addresses anymore, but handle them too.

Otherwise, during each resync we have link local addresses, and
platform-sync thinks that the address order is wrong. That wrongly
leads to remove most addresses and re-adding them.

Fixes: 78ed0a4a23
This commit is contained in:
Thomas Haller
2018-04-10 13:53:36 +02:00
parent 69e80d6c51
commit b50d7cc653

View File

@@ -3652,8 +3652,11 @@ nm_platform_ip6_address_sync (NMPlatform *self,
* If we don't find a matching valid address in @known_addresses, we will delete * If we don't find a matching valid address in @known_addresses, we will delete
* plat_addr. * plat_addr.
* *
* Certain addresses, like link-local or temporary addresses, are ignored by this function * Certain addresses, like temporary addresses, are ignored by this function
* if not run with full_sync. * if not run with full_sync. These addresses are usually not managed by NetworkManager
* directly, or at least, they are not managed via nm_platform_ip6_address_sync().
* Only in full_sync mode, we really want to get rid of them (usually, when we take
* the interface down).
* *
* Note that we mark handled addresses by setting it to %NULL in @plat_addresses array. */ * Note that we mark handled addresses by setting it to %NULL in @plat_addresses array. */
for (i_plat = 0; i_plat < plat_addresses->len; i_plat++) { for (i_plat = 0; i_plat < plat_addresses->len; i_plat++) {
@@ -3661,8 +3664,7 @@ nm_platform_ip6_address_sync (NMPlatform *self,
const NMPObject *know_obj; const NMPObject *know_obj;
const NMPlatformIP6Address *plat_addr = NMP_OBJECT_CAST_IP6_ADDRESS (plat_obj); const NMPlatformIP6Address *plat_addr = NMP_OBJECT_CAST_IP6_ADDRESS (plat_obj);
if ( NM_FLAGS_HAS (plat_addr->n_ifa_flags, IFA_F_TEMPORARY) if (NM_FLAGS_HAS (plat_addr->n_ifa_flags, IFA_F_TEMPORARY)) {
|| IN6_IS_ADDR_LINKLOCAL (&plat_addr->address)) {
if (!full_sync) { if (!full_sync) {
/* just mark as handled, without actually deleting the address. */ /* just mark as handled, without actually deleting the address. */
goto clear_and_next; goto clear_and_next;