]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/auth.c
Fix behaviour of maxoctets option when limit >= 2G
[ppp.git] / pppd / auth.c
index 424b3e54c1709156ad0812a8540863b2ca7d50c0..f615fd3ac11f94fc46a13b4008fa3f77ab694c08 100644 (file)
@@ -68,7 +68,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID  "$Id: auth.c,v 1.114 2008/06/15 06:53:06 paulus Exp $"
+#define RCSID  "$Id: auth.c,v 1.116 2008/06/25 10:30:36 paulus Exp $"
 
 #include <stdio.h>
 #include <stddef.h>
@@ -190,6 +190,11 @@ int (*null_auth_hook) __P((struct wordlist **paddrs,
 
 int (*allowed_address_hook) __P((u_int32_t addr)) = NULL;
 
+#ifdef HAVE_MULTILINK
+/* Hook for plugin to hear when an interface joins a multilink bundle */
+void (*multilink_join_hook) __P((void)) = NULL;
+#endif
+
 /* A notifier for when the peer has authenticated itself,
    and we are proceeding to the network phase. */
 struct notifier *auth_up_notifier = NULL;
@@ -855,6 +860,8 @@ start_networks(unit)
 #ifdef HAVE_MULTILINK
     if (multilink) {
        if (mp_join_bundle()) {
+           if (multilink_join_hook)
+               (*multilink_join_hook)();
            if (updetach && !nodetach)
                detach();
            return;
@@ -1133,7 +1140,6 @@ static void
 check_maxoctets(arg)
     void *arg;
 {
-    int diff;
     unsigned int used;
 
     update_link_stats(ifunit);
@@ -1154,8 +1160,7 @@ check_maxoctets(arg)
            used = link_stats.bytes_in+link_stats.bytes_out;
            break;
     }
-    diff = maxoctets - used;
-    if(diff < 0) {
+    if (used > maxoctets) {
        notice("Traffic limit reached. Limit: %u Used: %u", maxoctets, used);
        status = EXIT_TRAFFIC_LIMIT;
        lcp_close(0, "Traffic limit");