diff options
author | Per Ekman <pek@kth.se> | 2011-04-11 18:33:48 +0300 |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2011-04-11 18:33:48 +0300 |
commit | 0b04889f0dc30955862b88d0edf02cda09820b32 (patch) | |
tree | 9c33eae4190edc23faa355197e4b15a4929b0a02 /src/ap/accounting.c | |
parent | c2197bc9bcec707f7844bf64352414706b071879 (diff) | |
download | external_wpa_supplicant_8_ti-0b04889f0dc30955862b88d0edf02cda09820b32.zip external_wpa_supplicant_8_ti-0b04889f0dc30955862b88d0edf02cda09820b32.tar.gz external_wpa_supplicant_8_ti-0b04889f0dc30955862b88d0edf02cda09820b32.tar.bz2 |
Remove references to time_t/time()/random()
Replace direct calls in AP mode code with os_*() wrappers.
Diffstat (limited to 'src/ap/accounting.c')
-rw-r--r-- | src/ap/accounting.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/ap/accounting.c b/src/ap/accounting.c index e48503e..dbfb058 100644 --- a/src/ap/accounting.c +++ b/src/ap/accounting.c @@ -276,6 +276,7 @@ static void accounting_sta_report(struct hostapd_data *hapd, struct radius_msg *msg; int cause = sta->acct_terminate_cause; struct hostap_sta_driver_data data; + struct os_time now; u32 gigawords; if (!hapd->conf->radius->acct_server) @@ -289,8 +290,9 @@ static void accounting_sta_report(struct hostapd_data *hapd, return; } + os_get_time(&now); if (!radius_msg_add_attr_int32(msg, RADIUS_ATTR_ACCT_SESSION_TIME, - time(NULL) - sta->acct_session_start)) { + now.sec - sta->acct_session_start)) { printf("Could not add Acct-Session-Time\n"); goto fail; } @@ -345,7 +347,7 @@ static void accounting_sta_report(struct hostapd_data *hapd, } if (!radius_msg_add_attr_int32(msg, RADIUS_ATTR_EVENT_TIMESTAMP, - time(NULL))) { + now.sec)) { printf("Could not add Event-Timestamp\n"); goto fail; } @@ -476,9 +478,12 @@ static void accounting_report_state(struct hostapd_data *hapd, int on) */ int accounting_init(struct hostapd_data *hapd) { + struct os_time now; + /* Acct-Session-Id should be unique over reboots. If reliable clock is * not available, this could be replaced with reboot counter, etc. */ - hapd->acct_session_id_hi = time(NULL); + os_get_time(&now); + hapd->acct_session_id_hi = now.sec; if (radius_client_register(hapd->radius, RADIUS_ACCT, accounting_receive, hapd)) |