]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
RADIUS server: Use monotonic time
authorJohannes Berg <johannes.berg@intel.com>
Mon, 16 Dec 2013 20:08:30 +0000 (21:08 +0100)
committerJouni Malinen <j@w1.fi>
Tue, 24 Dec 2013 05:32:16 +0000 (07:32 +0200)
The RADIUS server needs to calculate uptime, which is relative
and thus should use monotonic time.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

src/radius/radius_server.c

index fe197704da84df4e81cc08f46027d6d2baa05b53..48b3c700810c7ba888389d232b0b2b8f6d36cd4c 100644 (file)
@@ -244,7 +244,7 @@ struct radius_server_data {
        /**
         * start_time - Timestamp of server start
         */
-       struct os_time start_time;
+       struct os_reltime start_time;
 
        /**
         * counters - Statistics counters for server operations
@@ -1261,7 +1261,7 @@ radius_server_init(struct radius_server_conf *conf)
        if (data == NULL)
                return NULL;
 
-       os_get_time(&data->start_time);
+       os_get_reltime(&data->start_time);
        data->conf_ctx = conf->conf_ctx;
        data->eap_sim_db_priv = conf->eap_sim_db_priv;
        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;
        unsigned int idx;
        char *end, *pos;
-       struct os_time now;
+       struct os_reltime now;
        struct radius_client *cli;
 
        /* RFC 2619 - RADIUS Authentication Server MIB */
@@ -1386,7 +1386,7 @@ int radius_server_get_mib(struct radius_server_data *data, char *buf,
        pos = buf;
        end = buf + buflen;
 
-       os_get_time(&now);
+       os_get_reltime(&now);
        uptime = (now.sec - data->start_time.sec) * 100 +
                ((now.usec - data->start_time.usec) / 10000) % 100;
        ret = os_snprintf(pos, end - pos,