From 52dbb7711faf0f2e79c5f66443d218d1efdccf87 Mon Sep 17 00:00:00 2001
From: Maxime Bizon <mbizon@freebox.fr>
Date: Thu, 16 Jan 2020 01:00:44 +0100
Subject: [PATCH 06/18] pppd: add notifier when peer auth status change

---
 pppd/auth.c | 5 +++++
 pppd/pppd.h | 1 +
 2 files changed, 6 insertions(+)

diff --git a/pppd/auth.c b/pppd/auth.c
index ec13710..fb69806 100644
--- a/pppd/auth.c
+++ b/pppd/auth.c
@@ -202,6 +202,9 @@ void (*multilink_join_hook) __P((void)) = NULL;
    and we are proceeding to the network phase. */
 struct notifier *auth_up_notifier = NULL;
 
+/* A notifier after auth with peer change status */
+struct notifier *auth_with_peer_notifier = NULL;
+
 /* A notifier for when the link goes down. */
 struct notifier *link_down_notifier = NULL;
 
@@ -1007,6 +1010,7 @@ auth_withpeer_fail(unit, protocol)
      * authentication secrets.
      */
     status = EXIT_AUTH_TOPEER_FAILED;
+    notify(auth_with_peer_notifier, 0);
     lcp_close(unit, "Failed to authenticate ourselves to peer");
 }
 
@@ -1053,6 +1057,7 @@ auth_withpeer_success(unit, protocol, prot_flavor)
 	bit = 0;
     }
 
+    notify(auth_with_peer_notifier, bit);
     notice("%s authentication succeeded", prot);
 
     /* Save the authentication method for later. */
diff --git a/pppd/pppd.h b/pppd/pppd.h
index 122a042..6baa724 100644
--- a/pppd/pppd.h
+++ b/pppd/pppd.h
@@ -275,6 +275,7 @@ extern struct notifier *ip_down_notifier;   /* IPCP has gone down */
 extern struct notifier *ipv6_up_notifier;   /* IPV6CP has come up */
 extern struct notifier *ipv6_down_notifier; /* IPV6CP has gone down */
 extern struct notifier *auth_up_notifier; /* peer has authenticated */
+extern struct notifier *auth_with_peer_notifier; /* we have authenticated  */
 extern struct notifier *link_down_notifier; /* link has gone down */
 extern struct notifier *fork_notifier;	/* we are a new child process */
 extern struct notifier *first_lcp_notifier; /* first LCP packet received */
-- 
2.17.1

