]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/ipv6cp.c
pppd: Notify IPv6 up/down as we do for IPv4
[ppp.git] / pppd / ipv6cp.c
index 4a09c9aa3aeddbe6587c214a34d8cb34c6286611..4421d99bd920f9477904d49e8e8dbabecdf7b9b8 100644 (file)
@@ -179,6 +179,16 @@ int no_ifaceid_neg = 0;
 /* local vars */
 static int ipv6cp_is_up;
 
+/* Hook for a plugin to know when IPv6 protocol has come up */
+void (*ipv6_up_hook) __P((void)) = NULL;
+
+/* Hook for a plugin to know when IPv6 protocol has come down */
+void (*ipv6_down_hook) __P((void)) = NULL;
+
+/* Notifiers for when IPCPv6 goes up and down */
+struct notifier *ipv6_up_notifier = NULL;
+struct notifier *ipv6_down_notifier = NULL;
+
 /*
  * Callbacks for fsm code.  (CI = Configuration Information)
  */
@@ -1282,6 +1292,10 @@ ipv6cp_up(f)
     np_up(f->unit, PPP_IPV6);
     ipv6cp_is_up = 1;
 
+    notify(ipv6_up_notifier, 0);
+    if (ipv6_up_hook)
+       ipv6_up_hook();
+
     /*
      * Execute the ipv6-up script, like this:
      * /etc/ppp/ipv6-up interface tty speed local-LL remote-LL
@@ -1305,6 +1319,9 @@ ipv6cp_down(f)
 {
     IPV6CPDEBUG(("ipv6cp: down"));
     update_link_stats(f->unit);
+    notify(ipv6_down_notifier, 0);
+    if (ipv6_down_hook)
+       ipv6_down_hook();
     if (ipv6cp_is_up) {
        ipv6cp_is_up = 0;
        np_down(f->unit, PPP_IPV6);