Hi Thomas, Beniamino,
 thanks for taking time to read and reply to my previous message.

2017-11-24 21:55 GMT+01:00 Beniamino Galvani <[email protected]>:
> Actually, I don't think this can work since there isn't a GLib main
> loop... so probably we should just change the async calls to sync
> (perhaps only when we know that pppd is about to exit, i.e. for the
> DISCONNECT signal)?

Is it really needed to receive and process notifications about
internal pppd state changes? Since pppd is/should be running in
nopersist mode pppd should exit upon connection termination. Actually
there were only two 'live' cases where this information is used in NM
and both are related with disconnect and cause ppp_failed() to run as
mentioned in my previous message.

I attach patch I'm using now and it works OK for pppd with
ModemManager. I don't think it's directly upstreamable as it affects
pppoe and bluetooth (which have ppp_failed() copy-pasted) which I
can't test now and which would potentially be harmed by this patch but
maybe illustrates potential solution.

Best regards, Piotr.
diff --git a/src/devices/wwan/nm-device-modem.c b/src/devices/wwan/nm-device-modem.c
index 4a4d2f2..245cd58 100644
--- a/src/devices/wwan/nm-device-modem.c
+++ b/src/devices/wwan/nm-device-modem.c
@@ -76,38 +76,7 @@ ppp_failed (NMModem *modem,
 	NMDeviceModem *self = NM_DEVICE_MODEM (user_data);
 	NMDeviceStateReason reason = i_reason;
 
-	switch (nm_device_get_state (device)) {
-	case NM_DEVICE_STATE_PREPARE:
-	case NM_DEVICE_STATE_CONFIG:
-	case NM_DEVICE_STATE_NEED_AUTH:
-		nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, reason);
-		break;
-	case NM_DEVICE_STATE_IP_CONFIG:
-	case NM_DEVICE_STATE_IP_CHECK:
-	case NM_DEVICE_STATE_SECONDARIES:
-	case NM_DEVICE_STATE_ACTIVATED:
-		if (nm_device_activate_ip4_state_in_conf (device))
-			nm_device_activate_schedule_ip4_config_timeout (device);
-		else if (nm_device_activate_ip6_state_in_conf (device))
-			nm_device_activate_schedule_ip6_config_timeout (device);
-		else if (nm_device_activate_ip4_state_done (device)) {
-			nm_device_ip_method_failed (device,
-			                            AF_INET,
-			                            NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE);
-		} else if (nm_device_activate_ip6_state_done (device)) {
-			nm_device_ip_method_failed (device,
-			                            AF_INET6,
-			                            NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE);
-		} else {
-			_LOGW (LOGD_MB, "PPP failure in unexpected state %u", (guint) nm_device_get_state (device));
-			nm_device_state_changed (device,
-			                         NM_DEVICE_STATE_FAILED,
-			                         NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE);
-		}
-		break;
-	default:
-		break;
-	}
+	nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, reason);
 }
 
 static void
diff --git a/src/ppp/nm-pppd-plugin.c b/src/ppp/nm-pppd-plugin.c
index 9c47c33..9b22679 100644
--- a/src/ppp/nm-pppd-plugin.c
+++ b/src/ppp/nm-pppd-plugin.c
@@ -408,7 +408,6 @@ plugin_init (void)
 	pap_passwd_hook = get_credentials;
 	pap_check_hook = get_pap_check;
 
-	add_notifier (&phasechange, nm_phasechange, NULL);
 	add_notifier (&ip_up_notifier, nm_ip_up, NULL);
 	add_notifier (&exitnotify, nm_exit_notify, proxy);
 	add_ip6_notifier ();
_______________________________________________
networkmanager-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/networkmanager-list

Reply via email to