aboutsummaryrefslogtreecommitdiffstats
path: root/src/radius
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2016-02-06 14:27:52 (GMT)
committerJouni Malinen <j@w1.fi>2016-02-06 15:19:35 (GMT)
commit1fc63fe2998c6d4218b503e90d6c6fe4075f05ba (patch)
tree485cc55b19550c04092b7724c213c443b66cb246 /src/radius
parent2cbc6ffb3a996192b03d6af90b8558daba376768 (diff)
downloadhostap-1fc63fe2998c6d4218b503e90d6c6fe4075f05ba.zip
hostap-1fc63fe2998c6d4218b503e90d6c6fe4075f05ba.tar.gz
hostap-1fc63fe2998c6d4218b503e90d6c6fe4075f05ba.tar.bz2
RADIUS: Share a single function for generating session IDs
There is no need to maintain three copies of this functionality even if it is currently implemented as a single function call. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/radius')
-rw-r--r--src/radius/radius.c11
-rw-r--r--src/radius/radius.h2
2 files changed, 13 insertions, 0 deletions
diff --git a/src/radius/radius.c b/src/radius/radius.c
index d48a4b5..77f9980 100644
--- a/src/radius/radius.c
+++ b/src/radius/radius.c
@@ -1656,3 +1656,14 @@ u8 radius_msg_find_unlisted_attr(struct radius_msg *msg, u8 *attrs)
return 0;
}
+
+
+int radius_gen_session_id(u8 *id, size_t len)
+{
+ /*
+ * Acct-Session-Id and Acct-Multi-Session-Id should be globally and
+ * temporarily unique. A high quality random number is required
+ * therefore. This could be be improved by switching to a GUID.
+ */
+ return os_get_random(id, len);
+}
diff --git a/src/radius/radius.h b/src/radius/radius.h
index 9218c94..313fc65 100644
--- a/src/radius/radius.h
+++ b/src/radius/radius.h
@@ -319,4 +319,6 @@ int radius_copy_class(struct radius_class_data *dst,
u8 radius_msg_find_unlisted_attr(struct radius_msg *msg, u8 *attrs);
+int radius_gen_session_id(u8 *id, size_t len);
+
#endif /* RADIUS_H */