summaryrefslogtreecommitdiff
path: root/accel-pppd
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2016-06-07 20:40:55 +0300
committerDmitry Kozlov <xeb@mail.ru>2016-06-07 20:40:55 +0300
commit429ca0e6188594e5ccbce639d2d22576e5256e62 (patch)
tree42f87bcc5fdd4a454209326fa38757d6970711d1 /accel-pppd
parentd06572417e1e500d7bd56859335d2f7dd0f3fd8f (diff)
downloadaccel-ppp-429ca0e6188594e5ccbce639d2d22576e5256e62.tar.gz
accel-ppp-429ca0e6188594e5ccbce639d2d22576e5256e62.zip
radius: update Session-Timeout by CoA
Diffstat (limited to 'accel-pppd')
-rw-r--r--accel-pppd/radius/dm_coa.c5
-rw-r--r--accel-pppd/radius/radius.c11
-rw-r--r--accel-pppd/radius/radius_p.h2
3 files changed, 18 insertions, 0 deletions
diff --git a/accel-pppd/radius/dm_coa.c b/accel-pppd/radius/dm_coa.c
index fd59bf1..ea9743d 100644
--- a/accel-pppd/radius/dm_coa.c
+++ b/accel-pppd/radius/dm_coa.c
@@ -146,6 +146,7 @@ static void disconnect_request(struct radius_pd_t *rpd)
static void coa_request(struct radius_pd_t *rpd)
{
struct rad_attr_t *class;
+ struct rad_attr_t *attr;
void *prev_class = rpd->attr_class;
struct ev_radius_t ev = {
.ses = rpd->ses,
@@ -181,6 +182,10 @@ static void coa_request(struct radius_pd_t *rpd)
rad_packet_add_octets(rpd->acct_req->pack, NULL, "Class", rpd->attr_class, rpd->attr_class_len);
}
+ attr = rad_packet_find_attr(rpd->dm_coa_req, NULL, "Session-Timeout");
+ if (attr)
+ rad_update_session_timeout(rpd, attr->val.integer);
+
dm_coa_send_ack(serv.hnd.fd, rpd->dm_coa_req, &rpd->dm_coa_addr);
}
diff --git a/accel-pppd/radius/radius.c b/accel-pppd/radius/radius.c
index c8eaf95..c553708 100644
--- a/accel-pppd/radius/radius.c
+++ b/accel-pppd/radius/radius.c
@@ -369,6 +369,17 @@ static void session_timeout(struct triton_timer_t *t)
ap_session_terminate(rpd->ses, TERM_SESSION_TIMEOUT, 0);
}
+void rad_update_session_timeout(struct radius_pd_t *rpd, int timeout)
+{
+ rpd->session_timeout.expire_tv.tv_sec = timeout;
+ rpd->session_timeout.expire = session_timeout;
+
+ if (rpd->session_timeout.tpd)
+ triton_timer_mod(&rpd->session_timeout, 0);
+ else
+ triton_timer_add(rpd->ses->ctrl->ctx, &rpd->session_timeout, 0);
+}
+
static void ses_starting(struct ap_session *ses)
{
struct radius_pd_t *rpd = mempool_alloc(rpd_pool);
diff --git a/accel-pppd/radius/radius_p.h b/accel-pppd/radius/radius_p.h
index 24cfdbd..a01467d 100644
--- a/accel-pppd/radius/radius_p.h
+++ b/accel-pppd/radius/radius_p.h
@@ -225,6 +225,8 @@ void rad_server_fail(struct rad_server_t *);
void rad_server_timeout(struct rad_server_t *);
void rad_server_reply(struct rad_server_t *);
+void rad_update_session_timeout(struct radius_pd_t *rpd, int timeout);
+
void radius_restore_session(struct ap_session *ses, struct radius_pd_t *rpd);
struct rtnl_link_stats;