diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2010-11-25 22:29:10 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2010-11-25 22:29:10 +0300 |
commit | 1cf19a1c76a8e13ee60a111fc6d64df3683cd3bc (patch) | |
tree | fa57c6d6417b59b74bcaab0631c757ef9602fc11 /accel-pptpd/radius/dm_coa.c | |
parent | 194b2c29a31aafc59fb0e0fac90411aae2fcd9aa (diff) | |
download | accel-ppp-1cf19a1c76a8e13ee60a111fc6d64df3683cd3bc.tar.gz accel-ppp-1cf19a1c76a8e13ee60a111fc6d64df3683cd3bc.zip |
radius: fixed bug of double packet free when second DM request received in time when radius sends Accounting-Request Stop
Diffstat (limited to 'accel-pptpd/radius/dm_coa.c')
-rw-r--r-- | accel-pptpd/radius/dm_coa.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/accel-pptpd/radius/dm_coa.c b/accel-pptpd/radius/dm_coa.c index 4b89449d..5edbdd93 100644 --- a/accel-pptpd/radius/dm_coa.c +++ b/accel-pptpd/radius/dm_coa.c @@ -134,7 +134,10 @@ static void disconnect_request(struct radius_pd_t *rpd) dm_coa_send_ack(serv.hnd.fd, rpd->dm_coa_req, &rpd->dm_coa_addr); rad_packet_free(rpd->dm_coa_req); + + pthread_mutex_lock(&rpd->lock); rpd->dm_coa_req = NULL; + pthread_mutex_unlock(&rpd->lock); ppp_terminate(rpd->ppp, TERM_ADMIN_RESET, 0); } @@ -165,6 +168,13 @@ static void coa_request(struct radius_pd_t *rpd) pthread_mutex_unlock(&rpd->lock); } +void dm_coa_cancel(struct radius_pd_t *rpd) +{ + triton_cancel_call(rpd->ppp->ctrl->ctx, (triton_event_func)disconnect_request); + triton_cancel_call(rpd->ppp->ctrl->ctx, (triton_event_func)coa_request); + rad_packet_free(rpd->dm_coa_req); +} + static int dm_coa_read(struct triton_md_handler_t *h) { struct rad_packet_t *pack; @@ -216,9 +226,9 @@ static int dm_coa_read(struct triton_md_handler_t *h) memcpy(&rpd->dm_coa_addr, &addr, sizeof(addr)); if (pack->code == CODE_DISCONNECT_REQUEST) - triton_context_call(rpd->ppp->ctrl->ctx, (void (*)(void *))disconnect_request, rpd); + triton_context_call(rpd->ppp->ctrl->ctx, (triton_event_func)disconnect_request, rpd); else - triton_context_call(rpd->ppp->ctrl->ctx, (void (*)(void *))coa_request, rpd); + triton_context_call(rpd->ppp->ctrl->ctx, (triton_event_func)coa_request, rpd); pthread_mutex_unlock(&rpd->lock); |