]> git.ozlabs.org Git - ppp.git/commitdiff
radius: interim and stop frames should not depend on successful start. (#299)
authorJaco Kroon <jaco@uls.co.za>
Fri, 30 Jul 2021 03:24:08 +0000 (05:24 +0200)
committerGitHub <noreply@github.com>
Fri, 30 Jul 2021 03:24:08 +0000 (13:24 +1000)
It could simply be that the accounting server is temporarily down, and
any good accounting server should be able to recover from missed
start/stop frames.  In particular Acct-Session-Time on the first seen
interim update or even stop frame allows for determining start time.

Signed-off-by: Jaco Kroon <jaco@uls.co.za>
Co-authored-by: Jaco Kroon <jaco@iewc.co.za>
pppd/plugins/radius/radius.c

index 6ddd853db6784ae1ace9c6057830a70336b94208..44120e16d0ba120238c30ba9f5b4f11a9bd15b40 100644 (file)
@@ -112,7 +112,6 @@ static int radius_setmppekeys2(VALUE_PAIR *vp, REQUEST_INFO *req_info);
 #endif
 
 struct radius_state {
-    int accounting_started;
     int initialized;
     int client_port;
     int choose_ip;
@@ -961,12 +960,11 @@ radius_acct_start(void)
        /* RADIUS server could be down so make this a warning */
        syslog(LOG_WARNING,
                "Accounting START failed for %s", rstate.user);
-    } else {
-       rstate.accounting_started = 1;
-       /* Kick off periodic accounting reports */
-       if (rstate.acct_interim_interval) {
-           TIMEOUT(radius_acct_interim, NULL, rstate.acct_interim_interval);
-       }
+    }
+
+    /* Kick off periodic accounting reports */
+    if (rstate.acct_interim_interval) {
+       TIMEOUT(radius_acct_interim, NULL, rstate.acct_interim_interval);
     }
 }
 
@@ -992,14 +990,9 @@ radius_acct_stop(void)
        return;
     }
 
-    if (!rstate.accounting_started) {
-       return;
-    }
-
     if (rstate.acct_interim_interval)
        UNTIMEOUT(radius_acct_interim, NULL);
 
-    rstate.accounting_started = 0;
     rc_avpair_add(&send, PW_ACCT_SESSION_ID, rstate.session_id,
                   0, VENDOR_NONE);
 
@@ -1144,10 +1137,6 @@ radius_acct_interim(void *ignored)
        return;
     }
 
-    if (!rstate.accounting_started) {
-       return;
-    }
-
     rc_avpair_add(&send, PW_ACCT_SESSION_ID, rstate.session_id,
                   0, VENDOR_NONE);