RADIUS server: Use monotonic time
The RADIUS server needs to calculate uptime, which is relative and thus should use monotonic time. Signed-hostap: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
40128043ca
commit
587071765d
1 changed files with 4 additions and 4 deletions
|
@ -244,7 +244,7 @@ struct radius_server_data {
|
||||||
/**
|
/**
|
||||||
* start_time - Timestamp of server start
|
* start_time - Timestamp of server start
|
||||||
*/
|
*/
|
||||||
struct os_time start_time;
|
struct os_reltime start_time;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* counters - Statistics counters for server operations
|
* counters - Statistics counters for server operations
|
||||||
|
@ -1261,7 +1261,7 @@ radius_server_init(struct radius_server_conf *conf)
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
os_get_time(&data->start_time);
|
os_get_reltime(&data->start_time);
|
||||||
data->conf_ctx = conf->conf_ctx;
|
data->conf_ctx = conf->conf_ctx;
|
||||||
data->eap_sim_db_priv = conf->eap_sim_db_priv;
|
data->eap_sim_db_priv = conf->eap_sim_db_priv;
|
||||||
data->ssl_ctx = conf->ssl_ctx;
|
data->ssl_ctx = conf->ssl_ctx;
|
||||||
|
@ -1375,7 +1375,7 @@ int radius_server_get_mib(struct radius_server_data *data, char *buf,
|
||||||
int ret, uptime;
|
int ret, uptime;
|
||||||
unsigned int idx;
|
unsigned int idx;
|
||||||
char *end, *pos;
|
char *end, *pos;
|
||||||
struct os_time now;
|
struct os_reltime now;
|
||||||
struct radius_client *cli;
|
struct radius_client *cli;
|
||||||
|
|
||||||
/* RFC 2619 - RADIUS Authentication Server MIB */
|
/* RFC 2619 - RADIUS Authentication Server MIB */
|
||||||
|
@ -1386,7 +1386,7 @@ int radius_server_get_mib(struct radius_server_data *data, char *buf,
|
||||||
pos = buf;
|
pos = buf;
|
||||||
end = buf + buflen;
|
end = buf + buflen;
|
||||||
|
|
||||||
os_get_time(&now);
|
os_get_reltime(&now);
|
||||||
uptime = (now.sec - data->start_time.sec) * 100 +
|
uptime = (now.sec - data->start_time.sec) * 100 +
|
||||||
((now.usec - data->start_time.usec) / 10000) % 100;
|
((now.usec - data->start_time.usec) / 10000) % 100;
|
||||||
ret = os_snprintf(pos, end - pos,
|
ret = os_snprintf(pos, end - pos,
|
||||||
|
|
Loading…
Reference in a new issue