Blob Blame History Raw
From dae15bf2b3d7ebef817cacf22bbbc3a0e5ff1424 Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Mon, 4 Nov 2019 14:19:12 +0100
Subject: [PATCH] acd: poll the acd fd after starting the announcements

In nm_acd_manager_announce_addresses() we should not only start the
probes but also add the acd file descriptor to the main loop.
Otherwise, a timer is armed to send the announcements but it never
fires and no announcements are sent.

Fixes: d9a4b59c18e3 ('acd: adapt NM code and build options')

https://bugzilla.redhat.com/show_bug.cgi?id=1767681
(cherry picked from commit 14992ab9cdb6394d133c8ac7b88ad1e4a1e995b0)
(cherry picked from commit c36da8b990dcb4858e27abf87cc45cf7b550538c)
(cherry picked from commit 5798b1b814556e0ca224c092fa2887d603703c38)
---
 src/devices/nm-acd-manager.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/devices/nm-acd-manager.c b/src/devices/nm-acd-manager.c
index f437ce3a8..58bf4fd97 100644
--- a/src/devices/nm-acd-manager.c
+++ b/src/devices/nm-acd-manager.c
@@ -345,6 +345,8 @@ nm_acd_manager_start_probe (NMAcdManager *self, guint timeout)
 	if (success)
 		self->state = STATE_PROBING;
 
+	nm_assert (!self->channel);
+	nm_assert (self->event_id == 0);
 	n_acd_get_fd (self->acd, &fd);
 	self->channel = g_io_channel_unix_new (fd);
 	self->event_id = g_io_add_watch (self->channel, G_IO_IN, acd_event, self);
@@ -390,6 +392,7 @@ nm_acd_manager_announce_addresses (NMAcdManager *self)
 	GHashTableIter iter;
 	AddressInfo *info;
 	int r;
+	int fd;
 	gboolean success = TRUE;
 
 	r = acd_init (self);
@@ -429,6 +432,13 @@ nm_acd_manager_announce_addresses (NMAcdManager *self)
 		}
 	}
 
+	if (!self->channel) {
+		nm_assert (self->event_id == 0);
+		n_acd_get_fd (self->acd, &fd);
+		self->channel = g_io_channel_unix_new (fd);
+		self->event_id = g_io_add_watch (self->channel, G_IO_IN, acd_event, self);
+	}
+
 	return success ? 0 : -NME_UNSPEC;
 }
 
-- 
2.21.0