summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ppp/nm-pppd-plugin.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/ppp/nm-pppd-plugin.c b/src/ppp/nm-pppd-plugin.c
index 626dcdbd82..f0b9027ca4 100644
--- a/src/ppp/nm-pppd-plugin.c
+++ b/src/ppp/nm-pppd-plugin.c
@@ -51,7 +51,7 @@ static struct {
} gl;
static void
-nm_phasechange (void *data, int arg)
+nm_phasechange (int arg)
{
NMPPPStatus ppp_status = NM_PPP_STATUS_UNKNOWN;
char *ppp_phase;
@@ -168,6 +168,16 @@ nm_phasechange (void *data, int arg)
}
static void
+nm_phasechange_hook (void *data, int arg)
+{
+ /* We send the nofication in exitnotify instead */
+ if (arg == PHASE_DEAD)
+ return;
+
+ nm_phasechange (arg);
+}
+
+static void
nm_ip_up (void *data, int arg)
{
ipcp_options opts = ipcp_gotoptions[0];
@@ -181,7 +191,7 @@ nm_ip_up (void *data, int arg)
if (!opts.ouraddr) {
g_warning ("nm-ppp-plugin: didn't receive an internal IP from pppd!");
- nm_phasechange (NULL, PHASE_DEAD);
+ nm_phasechange (PHASE_DEAD);
return;
}
@@ -384,6 +394,11 @@ nm_exit_notify (void *data, int arg)
{
g_return_if_fail (G_IS_DBUS_CONNECTION (gl.dbus_connection));
+ /* We wait until this point to notify dead phase to make sure that
+ * the serial port has recovered already its original settings.
+ */
+ nm_phasechange (PHASE_DEAD);
+
g_message ("nm-ppp-plugin: cleaning up");
g_clear_object (&gl.dbus_connection);
@@ -435,7 +450,7 @@ plugin_init (void)
pap_passwd_hook = get_credentials;
pap_check_hook = get_pap_check;
- add_notifier (&phasechange, nm_phasechange, NULL);
+ add_notifier (&phasechange, nm_phasechange_hook, NULL);
add_notifier (&ip_up_notifier, nm_ip_up, NULL);
add_notifier (&exitnotify, nm_exit_notify, NULL);
add_ip6_notifier ();