platform: detect missing firmware on IFF_UP change
This commit is contained in:
@@ -886,6 +886,14 @@ link_change (NMPlatform *platform, int ifindex, struct rtnl_link *change)
|
|||||||
|
|
||||||
nle = rtnl_link_change (priv->nlh, rtnllink, change, 0);
|
nle = rtnl_link_change (priv->nlh, rtnllink, change, 0);
|
||||||
|
|
||||||
|
/* When netlink returns this error, it usually means it failed to find
|
||||||
|
* firmware for the device, especially on nm_platform_link_set_up ().
|
||||||
|
* This is basically the same check as in the original code and could
|
||||||
|
* potentially be improved.
|
||||||
|
*/
|
||||||
|
if (nle == -NLE_OBJ_NOTFOUND)
|
||||||
|
return NM_PLATFORM_ERROR_NO_FIRMWARE;
|
||||||
|
|
||||||
return refresh_object (platform, (struct nl_object *) rtnllink, nle);
|
return refresh_object (platform, (struct nl_object *) rtnllink, nle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -177,6 +177,8 @@ nm_platform_get_error_msg (void)
|
|||||||
return "object already exists";
|
return "object already exists";
|
||||||
case NM_PLATFORM_ERROR_NOT_SLAVE:
|
case NM_PLATFORM_ERROR_NOT_SLAVE:
|
||||||
return "link not a slave";
|
return "link not a slave";
|
||||||
|
case NM_PLATFORM_ERROR_NO_FIRMWARE:
|
||||||
|
return "firmware not found";
|
||||||
default:
|
default:
|
||||||
return "invalid error number";
|
return "invalid error number";
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,9 @@ typedef enum {
|
|||||||
/* object already exists */
|
/* object already exists */
|
||||||
NM_PLATFORM_ERROR_EXISTS,
|
NM_PLATFORM_ERROR_EXISTS,
|
||||||
/* object is not a slave */
|
/* object is not a slave */
|
||||||
NM_PLATFORM_ERROR_NOT_SLAVE
|
NM_PLATFORM_ERROR_NOT_SLAVE,
|
||||||
|
/* firmware is not found */
|
||||||
|
NM_PLATFORM_ERROR_NO_FIRMWARE
|
||||||
} NMPlatformError;
|
} NMPlatformError;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
Reference in New Issue
Block a user