[PATCH 05/10] Switch from using os_random() to using os_get_random(...) in ap_handle_timer(...)
Nick Lowe
nick.lowe at lugatech.com
Sun Feb 14 11:37:58 PST 2016
Switch from using os_random() to using
os_get_random(...) in ap_handle_timer(...) The intention is to facilitate the
future removal of os_random(). os_random() uses a low quality PRNG which we
should avoid using outright unless there is a compelling performance
justification to do so.
Signed-off-by: Nick Lowe <nick.lowe at lugatech.com>
---
src/ap/sta_info.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c
index 3d7c839..50737fd 100644
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -378,7 +378,10 @@ void ap_handle_timer(void *eloop_ctx, void *timeout_ctx)
* all stations at the same time if we have lots of associated
* stations that are idle (but keep re-associating).
*/
- int fuzz = os_random() % 20;
+ int fuzz = 0;
+ if (os_get_random((u8 *) &fuzz, sizeof(fuzz)) >= 0)
+ fuzz = fuzz % 20;
+
inactive_sec = hostapd_drv_get_inact_sec(hapd, sta->addr);
if (inactive_sec == -1) {
wpa_msg(hapd->msg_ctx, MSG_DEBUG,
--
2.5.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-Switch-from-using-os_random-to-using-os_get_random-..patch
Type: text/x-patch
Size: 1199 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/hostap/attachments/20160214/6c20ac95/attachment.bin>
More information about the Hostap
mailing list