summaryrefslogtreecommitdiff
path: root/accel-pppd
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2015-02-21 14:33:25 +0300
committerDmitry Kozlov <xeb@mail.ru>2015-02-21 14:33:25 +0300
commit9cafdf7bf0676179a40c11863666b1b6bc8f3403 (patch)
treeea2a2f406c477468017e67ff15025e7fed949222 /accel-pppd
parent9280d2cf0d7d514cc2a3aaf76608d8e053d287bc (diff)
downloadaccel-ppp-9cafdf7bf0676179a40c11863666b1b6bc8f3403.tar.gz
accel-ppp-9cafdf7bf0676179a40c11863666b1b6bc8f3403.zip
radius: override session's idle and timeout timers values by Idle-Timeout and Session-Timeout attributes
Diffstat (limited to 'accel-pppd')
-rw-r--r--accel-pppd/radius/radius.c30
-rw-r--r--accel-pppd/radius/radius_p.h1
2 files changed, 6 insertions, 25 deletions
diff --git a/accel-pppd/radius/radius.c b/accel-pppd/radius/radius.c
index 9b211be..64c85df 100644
--- a/accel-pppd/radius/radius.c
+++ b/accel-pppd/radius/radius.c
@@ -110,7 +110,7 @@ int rad_proc_attrs(struct rad_req_t *req)
rpd->session_timeout.expire_tv.tv_sec = attr->val.integer;
break;
case Idle_Timeout:
- rpd->idle_timeout.period = attr->val.integer * 1000;
+ rpd->ses->idle_timeout = attr->val.integer;
break;
case Class:
if (!rpd->attr_class)
@@ -155,6 +155,11 @@ int rad_proc_attrs(struct rad_req_t *req)
}
}
+ if (rpd->session_timeout.expire_tv.tv_sec && !(rpd->termination_action == Termination_Action_RADIUS_Request && rpd->ses->ctrl->ppp)) {
+ rpd->ses->session_timeout = rpd->session_timeout.expire_tv.tv_sec;
+ rpd->session_timeout.expire_tv.tv_sec = 0;
+ }
+
if (dns.ses)
triton_event_fire(EV_DNS, &dns);
@@ -281,21 +286,6 @@ static void session_timeout(struct triton_timer_t *t)
ap_session_terminate(rpd->ses, TERM_SESSION_TIMEOUT, 0);
}
-static void idle_timeout(struct triton_timer_t *t)
-{
- struct radius_pd_t *rpd = container_of(t, typeof(*rpd), idle_timeout);
-
- if (rpd->ses->stop_time)
- return;
-
- ap_session_read_stats(rpd->ses, NULL);
-
- if (_time() - rpd->ses->idle_time > t->period / 1000) {
- log_ppp_msg("radius: idle timed out\n");
- ap_session_terminate(rpd->ses, TERM_IDLE_TIMEOUT, 0);
- }
-}
-
static void ses_starting(struct ap_session *ses)
{
struct radius_pd_t *rpd = mempool_alloc(rpd_pool);
@@ -351,11 +341,6 @@ static void ses_started(struct ap_session *ses)
rpd->session_timeout.expire = session_timeout;
triton_timer_add(ses->ctrl->ctx, &rpd->session_timeout, 0);
}
-
- if (rpd->idle_timeout.period) {
- rpd->idle_timeout.expire = idle_timeout;
- triton_timer_add(ses->ctrl->ctx, &rpd->idle_timeout, 0);
- }
}
static void ses_finishing(struct ap_session *ses)
@@ -406,9 +391,6 @@ static void ses_finished(struct ap_session *ses)
if (rpd->session_timeout.tpd)
triton_timer_del(&rpd->session_timeout);
- if (rpd->idle_timeout.tpd)
- triton_timer_del(&rpd->idle_timeout);
-
if (rpd->attr_class)
_free(rpd->attr_class);
diff --git a/accel-pppd/radius/radius_p.h b/accel-pppd/radius/radius_p.h
index 9687f82..cf7cbc8 100644
--- a/accel-pppd/radius/radius_p.h
+++ b/accel-pppd/radius/radius_p.h
@@ -39,7 +39,6 @@ struct radius_pd_t {
struct triton_timer_t acct_interim_timer;
struct triton_timer_t session_timeout;
- struct triton_timer_t idle_timeout;
struct rad_packet_t *dm_coa_req;
struct sockaddr_in dm_coa_addr;