summaryrefslogtreecommitdiff
path: root/accel-pptpd/radius
diff options
context:
space:
mode:
authorKozlov Dmitry <dima@server>2010-10-19 13:08:48 +0400
committerKozlov Dmitry <dima@server>2010-10-19 13:08:48 +0400
commitb61784a785b48429fe0a75fbcbb9d867eee509f5 (patch)
treec97d5fb3c198b686717099d7e9ad06c4a6a815f0 /accel-pptpd/radius
parentf7ac3aa1be2fe2a5bf987728e98544c4a20e57fb (diff)
downloadaccel-ppp-b61784a785b48429fe0a75fbcbb9d867eee509f5.tar.gz
accel-ppp-b61784a785b48429fe0a75fbcbb9d867eee509f5.zip
radius: implemented Acct-Terminate-Cause attribute
Diffstat (limited to 'accel-pptpd/radius')
-rw-r--r--accel-pptpd/radius/acct.c18
-rw-r--r--accel-pptpd/radius/dm_coa.c2
-rw-r--r--accel-pptpd/radius/radius.c4
3 files changed, 21 insertions, 3 deletions
diff --git a/accel-pptpd/radius/acct.c b/accel-pptpd/radius/acct.c
index 0c914cf..9ebd196 100644
--- a/accel-pptpd/radius/acct.c
+++ b/accel-pptpd/radius/acct.c
@@ -193,6 +193,24 @@ void rad_acct_stop(struct radius_pd_t *rpd)
if (rpd->acct_req->timeout.tpd)
triton_timer_del(&rpd->acct_req->timeout);
+ switch (rpd->ppp->terminate_cause) {
+ case TERM_USER_REQUEST:
+ rad_packet_add_val(rpd->acct_req->pack, "Acct-Terminate-Cause", "User-Request");
+ break;
+ case TERM_SESSION_TIMEOUT:
+ rad_packet_add_val(rpd->acct_req->pack, "Acct-Terminate-Cause", "Session-Timeout");
+ break;
+ case TERM_ADMIN_RESET:
+ rad_packet_add_val(rpd->acct_req->pack, "Acct-Terminate-Cause", "Admin-Reset");
+ break;
+ case TERM_USER_ERROR:
+ case TERM_AUTH_ERROR:
+ rad_packet_add_val(rpd->acct_req->pack, "Acct-Terminate-Cause", "User-Error");
+ break;
+ case TERM_NAS_ERROR:
+ rad_packet_add_val(rpd->acct_req->pack, "Acct-Terminate-Cause", "NAS-Error");
+ break;
+ }
rad_packet_change_val(rpd->acct_req->pack, "Acct-Status-Type", "Stop");
req_set_stat(rpd->acct_req, rpd->ppp);
req_set_RA(rpd->acct_req, conf_acct_secret);
diff --git a/accel-pptpd/radius/dm_coa.c b/accel-pptpd/radius/dm_coa.c
index 2fb023c..84e725b 100644
--- a/accel-pptpd/radius/dm_coa.c
+++ b/accel-pptpd/radius/dm_coa.c
@@ -136,7 +136,7 @@ static void disconnect_request(struct radius_pd_t *rpd)
rad_packet_free(rpd->dm_coa_req);
rpd->dm_coa_req = NULL;
- ppp_terminate(rpd->ppp, 0);
+ ppp_terminate(rpd->ppp, TERM_ADMIN_RESET, 0);
}
static void coa_request(struct radius_pd_t *rpd)
diff --git a/accel-pptpd/radius/radius.c b/accel-pptpd/radius/radius.c
index 8a4020c..45f0ba9 100644
--- a/accel-pptpd/radius/radius.c
+++ b/accel-pptpd/radius/radius.c
@@ -120,7 +120,7 @@ static void session_timeout(struct triton_timer_t *t)
struct radius_pd_t *rpd = container_of(t, typeof(*rpd), session_timeout);
log_ppp_msg("radius: session timed out\n");
- ppp_terminate(rpd->ppp, 0);
+ ppp_terminate(rpd->ppp, TERM_SESSION_TIMEOUT, 0);
}
static void ppp_starting(struct ppp_t *ppp)
@@ -143,7 +143,7 @@ static void ppp_started(struct ppp_t *ppp)
struct radius_pd_t *rpd = find_pd(ppp);
if (rad_acct_start(rpd))
- ppp_terminate(rpd->ppp, 0);
+ ppp_terminate(rpd->ppp, TERM_NAS_ERROR, 0);
if (rpd->session_timeout.expire_tv.tv_sec) {
rpd->session_timeout.expire = session_timeout;