static gboolean pppoe_vcc_config (NMDeviceAdsl *self) { NMDeviceAdslPrivate *priv = NM_DEVICE_ADSL_GET_PRIVATE (self); NMDevice *device = NM_DEVICE (self); NMSettingAdsl *s_adsl; s_adsl = nm_connection_get_setting_adsl (nm_device_get_applied_connection (device)); g_assert (s_adsl); /* Set up the VCC */ if (!br2684_assign_vcc (self, s_adsl)) return FALSE; /* Watch for the 'nas' interface going away */ g_signal_connect (NM_PLATFORM_GET, NM_PLATFORM_SIGNAL_LINK_CHANGED, G_CALLBACK (link_changed_cb), self); _LOGD (LOGD_ADSL, "ATM setup successful"); /* otherwise we're good for stage3 */ nm_platform_link_set_up (NM_PLATFORM_GET, priv->nas_ifindex, NULL); return TRUE; }
static NMActStageReturn act_stage2_config (NMDevice *device, NMDeviceStateReason *out_reason) { NMDeviceAdsl *self = NM_DEVICE_ADSL (device); NMDeviceAdslPrivate *priv = NM_DEVICE_ADSL_GET_PRIVATE (self); NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE; NMSettingAdsl *s_adsl; const char *protocol; g_assert (out_reason); s_adsl = nm_connection_get_setting_adsl (nm_device_get_connection (device)); g_assert (s_adsl); protocol = nm_setting_adsl_get_protocol (s_adsl); nm_log_dbg (LOGD_ADSL, "(%s): using ADSL protocol '%s'", nm_device_get_iface (device), protocol); if (g_strcmp0 (protocol, NM_SETTING_ADSL_PROTOCOL_PPPOE) == 0) { /* PPPoE needs RFC2684 bridging before we can do PPP over it */ if (!br2684_create_iface (self, s_adsl)) { *out_reason = NM_DEVICE_STATE_REASON_BR2684_FAILED; goto done; } /* Set up the VCC */ if (!br2684_assign_vcc (self, s_adsl)) { *out_reason = NM_DEVICE_STATE_REASON_BR2684_FAILED; goto done; } /* Watch for the 'nas' interface going away */ priv->lost_link_id = g_signal_connect (nm_platform_get (), "link-removed", G_CALLBACK (lost_link), self); nm_log_dbg (LOGD_ADSL, "(%s): ATM setup successful", nm_device_get_iface (device)); /* otherwise we're good for stage3 */ nm_platform_link_set_up (priv->nas_ifindex); ret = NM_ACT_STAGE_RETURN_SUCCESS; } else if (g_strcmp0 (protocol, NM_SETTING_ADSL_PROTOCOL_PPPOA) == 0) { /* PPPoA doesn't need anything special */ ret = NM_ACT_STAGE_RETURN_SUCCESS; } else { nm_log_warn (LOGD_ADSL, "(%s): unhandled ADSL protocol '%s'", nm_device_get_iface (device), protocol); } done: return ret; }