diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2010-09-27 23:55:11 +0400 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2010-09-27 23:55:11 +0400 |
commit | 2902ea733331c1a083487666dbdd847518a0f117 (patch) | |
tree | c0d9239c735a5ef14561af4e6e866f16c154c723 /accel-pptpd/radius/radius.c | |
parent | f9bc7d57b20a0165862cfab7259f6147fcb15733 (diff) | |
parent | 0325cc5f07ac992414129b4f47ae4aae017dbd2b (diff) | |
download | accel-ppp-2902ea733331c1a083487666dbdd847518a0f117.tar.gz accel-ppp-2902ea733331c1a083487666dbdd847518a0f117.zip |
radius: implemented Session-Timeout attribute
Diffstat (limited to 'accel-pptpd/radius/radius.c')
-rw-r--r-- | accel-pptpd/radius/radius.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/accel-pptpd/radius/radius.c b/accel-pptpd/radius/radius.c index 38ace95..42b39a5 100644 --- a/accel-pptpd/radius/radius.c +++ b/accel-pptpd/radius/radius.c @@ -59,6 +59,8 @@ void rad_proc_attrs(struct rad_req_t *req) } } else if (!strcmp(attr->attr->name, "Acct-Interim-Interval")) req->rpd->acct_interim_interval = attr->val.integer; + else if (!strcmp(attr->attr->name, "Session-Timeout")) + req->rpd->session_timeout.expire_tv.tv_sec = attr->val.integer; } } @@ -105,6 +107,14 @@ static struct ipdb_item_t *get_ip(struct ppp_t *ppp) return NULL; } +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); +} + static void ppp_starting(struct ppp_t *ppp) { struct radius_pd_t *rpd = mempool_alloc(rpd_pool); @@ -126,6 +136,11 @@ static void ppp_started(struct ppp_t *ppp) if (rad_acct_start(rpd)) ppp_terminate(rpd->ppp, 0); + + if (rpd->session_timeout.expire_tv.tv_sec) { + rpd->session_timeout.expire = session_timeout; + triton_timer_add(ppp->ctrl->ctx, &rpd->session_timeout, 0); + } } static void ppp_finishing(struct ppp_t *ppp) { @@ -149,6 +164,9 @@ static void ppp_finished(struct ppp_t *ppp) if (rpd->dm_coa_req) rad_packet_free(rpd->dm_coa_req); + if (rpd->session_timeout.tpd) + triton_timer_del(&rpd->session_timeout); + list_del(&rpd->pd.entry); mempool_free(rpd); @@ -302,6 +320,10 @@ static void __init radius_init(void) if (opt) conf_nas_ip_address = opt; + opt = conf_get_opt("radius", "nas-identifier"); + if (opt) + conf_nas_identifier = opt; + opt = conf_get_opt("radius", "gw-ip-address"); if (opt) conf_gw_ip_address = opt; |