aboutsummaryrefslogtreecommitdiffstats
path: root/src/radius/radius_das.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2012-06-17 16:35:03 (GMT)
committerJouni Malinen <j@w1.fi>2012-06-17 16:35:03 (GMT)
commitff7e4589ea9cf5f2b09b3029d0ab00dd12301748 (patch)
tree9b09373ab96519ebf0b734850f426b4561efb98a /src/radius/radius_das.c
parent8047a958099516f570eca35dc6f3885a5809633a (diff)
downloadhostap-ff7e4589ea9cf5f2b09b3029d0ab00dd12301748.zip
hostap-ff7e4589ea9cf5f2b09b3029d0ab00dd12301748.tar.gz
hostap-ff7e4589ea9cf5f2b09b3029d0ab00dd12301748.tar.bz2
RADIUS DAS: Add Event-Timestamp attribute into ACK/NAK messages
Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/radius/radius_das.c')
-rw-r--r--src/radius/radius_das.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/radius/radius_das.c b/src/radius/radius_das.c
index 61e3518..a9fcb69 100644
--- a/src/radius/radius_das.c
+++ b/src/radius/radius_das.c
@@ -149,6 +149,7 @@ static void radius_das_receive(int sock, void *eloop_ctx, void *sock_ctx)
struct wpabuf *rbuf;
u32 val;
int res;
+ struct os_time now;
fromlen = sizeof(from);
len = recvfrom(sock, buf, sizeof(buf), 0,
@@ -185,13 +186,11 @@ static void radius_das_receive(int sock, void *eloop_ctx, void *sock_ctx)
goto fail;
}
+ os_get_time(&now);
res = radius_msg_get_attr(msg, RADIUS_ATTR_EVENT_TIMESTAMP,
(u8 *) &val, 4);
if (res == 4) {
u32 timestamp = ntohl(val);
- struct os_time now;
-
- os_get_time(&now);
if (abs(now.sec - timestamp) > das->time_window) {
wpa_printf(MSG_DEBUG, "DAS: Unacceptable "
"Event-Timestamp (%u; local time %u) in "
@@ -231,6 +230,13 @@ static void radius_das_receive(int sock, void *eloop_ctx, void *sock_ctx)
if (reply) {
wpa_printf(MSG_DEBUG, "DAS: Reply to %s:%d", abuf, from_port);
+ if (!radius_msg_add_attr_int32(reply,
+ RADIUS_ATTR_EVENT_TIMESTAMP,
+ now.sec)) {
+ wpa_printf(MSG_DEBUG, "DAS: Failed to add "
+ "Event-Timestamp attribute");
+ }
+
if (radius_msg_finish_das_resp(reply, das->shared_secret,
das->shared_secret_len, hdr) <
0) {