discover/network: Search by UUID only if available
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>
Fri, 23 Dec 2016 01:01:26 +0000 (12:01 +1100)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Thu, 12 Jan 2017 04:37:09 +0000 (15:37 +1100)
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

index 69223b149adacd0c133beb06de88d06300e324a4..c3cf30ac973b54f875d56356fc58910190240e0d 100644 (file)
@@ -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;