linux-ppp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ray Van Dolson <rayvd@digitalpath.net>
To: linux-ppp@vger.kernel.org
Subject: Re: Radius plugin bug.
Date: Wed, 05 Jul 2006 19:40:21 +0000	[thread overview]
Message-ID: <20060705194021.GA13527@digitalpath.net> (raw)
In-Reply-To: <20060629065205.GA18383@digitalpath.net>

Well have been working on this a little, and may have found a potential
solution that works.

Feedback would be appreciate from real programmers as to negative
consequences of reorganizing the code a little...

Basically, I am removing the calls to free the ppp interface from the
link_terminated function and relocating them to later in the process --
after the plugin cleanup functions have been called removing the radius
attribute file.

Seems to be working OK so far on our server...

diff -uNrp ppp-2.4.3.orig/pppd/auth.c ppp-2.4.3/pppd/auth.c
--- ppp-2.4.3.orig/pppd/auth.c	2004-11-12 02:30:51.000000000 -0800
+++ ppp-2.4.3/pppd/auth.c	2006-07-05 12:03:47.000000000 -0700
@@ -83,6 +83,7 @@
 #include <sys/socket.h>
 #include <utmp.h>
 #include <fcntl.h>
 #if defined(_PATH_LASTLOG) && defined(__linux__)
 #include <lastlog.h>
 #endif
@@ -621,6 +622,7 @@ link_terminated(unit)
      * the ppp unit back to the loopback.  Set the
      * real serial device back to its normal mode of operation.
      */
+    /*
     if (fd_ppp >= 0) {
 	remove_fd(fd_ppp);
 	clean_check();
@@ -629,6 +631,8 @@ link_terminated(unit)
 	    mp_exit_bundle();
 	fd_ppp = -1;
     }
+    */
     if (!hungup)
 	lcp_lowerdown(0);
     if (!doing_multilink && !demand)
@@ -638,10 +642,14 @@ link_terminated(unit)
      * Run disconnector script, if requested.
      * XXX we may not be able to do this if the line has hung up!
      */
+    /*
     if (devfd >= 0 && the_channel->disconnect) {
 	the_channel->disconnect();
 	devfd = -1;
     }
+    */
 
     if (doing_multilink && multilink_master) {
 	if (!bundle_terminating)
diff -uNrp ppp-2.4.3.orig/pppd/main.c ppp-2.4.3/pppd/main.c
--- ppp-2.4.3.orig/pppd/main.c	2004-11-13 04:05:48.000000000 -0800
+++ ppp-2.4.3/pppd/main.c	2006-07-05 12:03:52.000000000 -0700
@@ -1098,8 +1108,9 @@ die(status)
 {
     if (!doing_multilink || multilink_master)
 	print_link_stats();
-    cleanup();
     notify(exitnotify, status);
+    cleanup();
     syslog(LOG_INFO, "Exit.");
     exit(status);
 }
@@ -1113,10 +1124,46 @@ cleanup()
 {
     sys_cleanup();
 
-    if (fd_ppp >= 0)
+    /*
+    if (fd_ppp >= 0) {
+        syslog(LOG_INFO, "Calling disestablish_ppp from cleanup()");
 	the_channel->disestablish_ppp(devfd);
-    if (the_channel->cleanup)
+    }
+    */
+
+    /*
+     * If we may want to bring the link up again, transfer
+     * the ppp unit back to the loopback.  Set the
+     * real serial device back to its normal mode of operation.
+     */
+
+    if (fd_ppp >= 0) {
+	remove_fd(fd_ppp);
+	clean_check();
+        syslog(LOG_INFO, "Calling disestablish_ppp from cleanup()");
+	the_channel->disestablish_ppp(devfd);
+	if (doing_multilink)
+	    mp_exit_bundle();
+	fd_ppp = -1;
+    }
+
+    /*
+     * Run disconnector script, if requested.
+     * XXX we may not be able to do this if the line has hung up!
+     */
+    if (devfd >= 0 && the_channel->disconnect) {
+	syslog(LOG_INFO, "Running disconnector scripts...");
+	the_channel->disconnect();
+	devfd = -1;
+	syslog(LOG_INFO, "Finished running disconnector scripts...");
+    }
+
+    if (the_channel->cleanup) {
+        syslog(LOG_INFO, "Calling cleanup from cleanup()");
 	(*the_channel->cleanup)();
+    }
+
+    syslog(LOG_INFO, "Removing pidfiles.");
     remove_pidfiles();
 
 #ifdef USE_TDB

  parent reply	other threads:[~2006-07-05 19:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-29  6:52 Radius plugin bug Ray Van Dolson
2006-06-29  9:37 ` Ben McKeegan
2006-06-29 22:22 ` Ray Van Dolson
2006-06-29 23:02 ` Paul Mackerras
2006-07-05 19:40 ` Ray Van Dolson [this message]
2006-07-11 15:25 ` Ray Van Dolson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060705194021.GA13527@digitalpath.net \
    --to=rayvd@digitalpath.net \
    --cc=linux-ppp@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).