device: use ppp device for new style pppoe setting

This commit is contained in:
Beniamino Galvani 2017-06-30 17:51:04 +02:00
parent 6c3195931e
commit a7afa9ead7
2 changed files with 23 additions and 0 deletions

View file

@ -1952,6 +1952,13 @@ nm_connection_is_virtual (NMConnection *connection)
if (nm_streq (type, NM_SETTING_BLUETOOTH_SETTING_NAME))
return !!_nm_connection_get_setting_bluetooth_for_nap (connection);
if (nm_streq (type, NM_SETTING_PPPOE_SETTING_NAME)) {
NMSettingPppoe *s_pppoe;
s_pppoe = nm_connection_get_setting_pppoe (connection);
return !!nm_setting_pppoe_get_parent (s_pppoe);
}
return FALSE;
}

View file

@ -1796,8 +1796,24 @@ create_device (NMDeviceFactory *factory,
NULL);
}
static gboolean
match_connection (NMDeviceFactory *factory, NMConnection *connection)
{
const char *type = nm_connection_get_connection_type (connection);
NMSettingPppoe *s_pppoe;
if (nm_streq (type, NM_SETTING_WIRED_SETTING_NAME))
return TRUE;
nm_assert (nm_streq (type, NM_SETTING_PPPOE_SETTING_NAME));
s_pppoe = nm_connection_get_setting_pppoe (connection);
return !nm_setting_pppoe_get_parent (s_pppoe);
}
NM_DEVICE_FACTORY_DEFINE_INTERNAL (ETHERNET, Ethernet, ethernet,
NM_DEVICE_FACTORY_DECLARE_LINK_TYPES (NM_LINK_TYPE_ETHERNET)
NM_DEVICE_FACTORY_DECLARE_SETTING_TYPES (NM_SETTING_WIRED_SETTING_NAME, NM_SETTING_PPPOE_SETTING_NAME),
factory_class->create_device = create_device;
factory_class->match_connection = match_connection;
);