summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2019-07-01 13:45:27 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2019-07-03 09:39:03 +0200
commite865f83d3064f0e9dddd47513282ae012e7576c3 (patch)
tree9bc8f7818851b2528964b453a33e9a2db3f74539
parentf0e4137e1dc49c424ca082bd79715fcbab5ee654 (diff)
downloadNetworkManager-bg/pppoe-issue203.tar.gz
device: ppp: check that connection has a PPPoE parentbg/pppoe-issue203
NMDevicePPP only handles connections with the pppoe.parent property set. match_connection() already checks this when we creating a new device. We should also perform the same check in check_connection_compatible(). Fixes: 6c3195931e94 ('core: implement activation of PPP devices') https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/203
-rw-r--r--src/devices/nm-device-ppp.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/devices/nm-device-ppp.c b/src/devices/nm-device-ppp.c
index 7a46c67d64..83f440df55 100644
--- a/src/devices/nm-device-ppp.c
+++ b/src/devices/nm-device-ppp.c
@@ -116,6 +116,25 @@ ppp_ip4_config (NMPPPManager *ppp_manager,
}
}
+static gboolean
+check_connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
+{
+ NMSettingPppoe *s_pppoe;
+
+ if (!NM_DEVICE_CLASS (nm_device_ppp_parent_class)->check_connection_compatible (device, connection, error))
+ return FALSE;
+
+ s_pppoe = nm_connection_get_setting_pppoe (connection);
+ if ( !s_pppoe
+ || !nm_setting_pppoe_get_parent (s_pppoe)) {
+ nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_INCOMPATIBLE,
+ "the connection doesn't specify a PPPoE parent interface");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static NMActStageReturn
act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
{
@@ -276,6 +295,7 @@ nm_device_ppp_class_init (NMDevicePppClass *klass)
device_class->connection_type_supported = NM_SETTING_PPPOE_SETTING_NAME;
device_class->connection_type_check_compatible = NM_SETTING_PPPOE_SETTING_NAME;
device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES (NM_LINK_TYPE_PPP);
+ device_class->check_connection_compatible = check_connection_compatible;
device_class->act_stage2_config = act_stage2_config;
device_class->act_stage3_ip_config_start = act_stage3_ip_config_start;