From: Jaco Kroon Date: Fri, 30 Jul 2021 03:24:08 +0000 (+0200) Subject: radius: interim and stop frames should not depend on successful start. (#299) X-Git-Tag: ppp-2.5.0~64 X-Git-Url: http://git.ozlabs.org/?a=commitdiff_plain;h=7fc276dee025815eb8d116f52d9193808b164bbd;p=ppp.git radius: interim and stop frames should not depend on successful start. (#299) 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 Co-authored-by: Jaco Kroon --- diff --git a/pppd/plugins/radius/radius.c b/pppd/plugins/radius/radius.c index 6ddd853..44120e1 100644 --- a/pppd/plugins/radius/radius.c +++ b/pppd/plugins/radius/radius.c @@ -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);