arping-manager: failure to get a device name should not be fatal
authorLubomir Rintel <lkundrak@v3.sk>
Fri, 26 Feb 2016 12:30:56 +0000 (13:30 +0100)
committerLubomir Rintel <lkundrak@v3.sk>
Fri, 26 Feb 2016 12:37:01 +0000 (13:37 +0100)
The device could just be removed mid-flight.

src/devices/nm-arping-manager.c

index ea10609..dfb20b4 100644 (file)
@@ -193,7 +193,12 @@ nm_arping_manager_start_probe (NMArpingManager *self, guint timeout, GError **er
        g_return_val_if_fail (priv->state == STATE_INIT, FALSE);
 
        argv[4] = nm_platform_link_get_name (NM_PLATFORM_GET, priv->ifindex);
-       g_return_val_if_fail (argv[4], FALSE);
+       if (!argv[4]) {
+               /* The device was probably just removed. */
+               g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED,
+                            "can't find a name for ifindex %d", priv->ifindex);
+               return FALSE;
+       }
 
        priv->completed = 0;
 
@@ -306,7 +311,11 @@ send_announcements (NMArpingManager *self, const char *mode_arg)
        AddressInfo *info;
 
        argv[4] = nm_platform_link_get_name (NM_PLATFORM_GET, priv->ifindex);
-       g_return_if_fail (argv[4]);
+       if (!argv[4]) {
+               /* The device was probably just removed. */
+               _LOGW ("can't find a name for ifindex %d", priv->ifindex);
+               return;
+       }
 
        argv[0] = nm_utils_find_helper ("arping", NULL, NULL);
        if (!argv[0]) {