core: assert for valid NM_DEVICE_DEVICE_TYPE setting

(cherry picked from commit 7dd44d6dc8)
This commit is contained in:
Thomas Haller 2019-03-07 22:38:22 +01:00
parent 4251f4e476
commit 355cbbfb5c
2 changed files with 3 additions and 0 deletions

View file

@ -16344,6 +16344,8 @@ set_property (GObject *object, guint prop_id,
/* construct-only */
nm_assert (priv->type == NM_DEVICE_TYPE_UNKNOWN);
priv->type = g_value_get_uint (value);
nm_assert (priv->type > NM_DEVICE_TYPE_UNKNOWN);
nm_assert (priv->type <= NM_DEVICE_TYPE_WIFI_P2P);
break;
case PROP_LINK_TYPE:
/* construct-only */

View file

@ -75,6 +75,7 @@ nm_test_device_new (const char *hwaddr)
return g_object_new (NM_TYPE_TEST_DEVICE,
NM_DEVICE_IFACE, "dummy",
NM_DEVICE_PERM_HW_ADDRESS, hwaddr,
NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_ETHERNET,
NULL);
}