eapol_test: Start the identifier at an initial random value

Message ID 20180920130601.GA25015@moon.uakom.sk
State New
Headers show
Series
  • eapol_test: Start the identifier at an initial random value
Related show

Commit Message

Martin Stanislav Sept. 20, 2018, 1:06 p.m.
From: Martin Stanislav <ms@uakom.sk>

Start the (EAP request) identifier at an initial random value
as recommended by RFC 3748 in section 4.1 Request and Response
on page 21.

Signed-off-by: Martin Stanislav <ms@uakom.sk>
---
 wpa_supplicant/eapol_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nick Lowe Sept. 20, 2018, 1:13 p.m. | #1
Hi Martin,

I would suggest using os_get_random instead of os_random for this.

Regards

Nick

Patch

diff --git a/wpa_supplicant/eapol_test.c b/wpa_supplicant/eapol_test.c
index 6548bd1..c99bebf 100644
--- a/wpa_supplicant/eapol_test.c
+++ b/wpa_supplicant/eapol_test.c
@@ -711,7 +711,7 @@  static void send_eap_request_identity(void *eloop_ctx, void *timeout_ctx)
 
 	eap = (struct eap_hdr *) (hdr + 1);
 	eap->code = EAP_CODE_REQUEST;
-	eap->identifier = 0;
+	eap->identifier = os_random() % 256;
 	eap->length = htons(5);
 	pos = (u8 *) (eap + 1);
 	*pos = EAP_TYPE_IDENTITY;