[1/2] discover/network: Search by UUID only if available
diff mbox

Message ID 20170112044002.30422-1-sam@mendozajonas.com
State Accepted
Headers show

Commit Message

Samuel Mendoza-Jonas Jan. 12, 2017, 4:40 a.m. UTC
When registering a new discover device it is possible the device does
not have an associated UUID, for example when created via
device_handler_process_url(). Fall back to find_interface_by_name() in
this case.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
---
 discover/network.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch
diff mbox

diff --git a/discover/network.c b/discover/network.c
index 69223b1..c3cf30a 100644
--- a/discover/network.c
+++ b/discover/network.c
@@ -242,7 +242,10 @@  void network_register_device(struct network *network,
 {
 	struct interface *iface;
 
-	iface = find_interface_by_uuid(network, dev->uuid);
+	if (dev->uuid)
+		iface = find_interface_by_uuid(network, dev->uuid);
+	else
+		iface = find_interface_by_name(network, dev->label);
 	if (!iface)
 		return;