diff options
Diffstat (limited to 'accel-pppd/radius/auth.c')
-rw-r--r-- | accel-pppd/radius/auth.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/accel-pppd/radius/auth.c b/accel-pppd/radius/auth.c index 692830ed..70ecbbe2 100644 --- a/accel-pppd/radius/auth.c +++ b/accel-pppd/radius/auth.c @@ -145,9 +145,12 @@ static uint8_t* encrypt_password(const char *passwd, const char *secret, const u static int rad_auth_send(struct rad_req_t *req) { int i; + struct timeval tv; + unsigned int dt; for(i = 0; i < conf_max_try; i++) { __sync_add_and_fetch(&stat_auth_sent, 1); + gettimeofday(&tv, NULL); if (rad_req_send(req, conf_verbose)) goto out; @@ -156,12 +159,20 @@ static int rad_auth_send(struct rad_req_t *req) if (req->reply) { if (req->reply->id != req->pack->id) { __sync_add_and_fetch(&stat_auth_lost, 1); + stat_accm_add(stat_auth_lost_1m, 1); + stat_accm_add(stat_auth_lost_5m, 1); rad_packet_free(req->reply); req->reply = NULL; - } else + } else { + dt = (req->reply->tv.tv_sec - tv.tv_sec) * 1000 + (req->reply->tv.tv_usec - tv.tv_usec) / 1000; + stat_accm_add(stat_auth_query_1m, dt); + stat_accm_add(stat_auth_query_5m, dt); break; + } } else __sync_add_and_fetch(&stat_auth_lost, 1); + stat_accm_add(stat_auth_lost_1m, 1); + stat_accm_add(stat_auth_lost_5m, 1); } if (!req->reply) |