Patchwork WPA: pairwise should be printed as a bool

login
register
mail settings
Submitter Johannes Berg
Date May 2, 2013, 9:29 a.m.
Message ID <1367486987-6465-1-git-send-email-johannes@sipsolutions.net>
Download mbox | patch
Permalink /patch/240914/
State Accepted
Commit 8543ed8a378ae7400fc5585a8993d43ef0b0bb39
Headers show

Comments

Johannes Berg - May 2, 2013, 9:29 a.m.
From: Johannes Berg <johannes.berg@intel.com>

Since "pairwise" is defined as an integer, the current
assignment leads to it having the value 0 or 8, which
is a bit strange in debug output:

WPA: Send EAPOL(version=2 secure=1 mic=1 ack=1 install=1 pairwise=8 kde_len=46 keyidx=2 encr=1)

Use !!(...) to normalize it to 0 or 1.

Change-Id: I72735a4fd68c9bc768fe833ab8b175715e77d8c3
Signed-hostap: Johannes Berg <johannes.berg@intel.com>
---
 src/ap/wpa_auth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Jouni Malinen - May 4, 2013, 8:50 a.m.
On Thu, May 02, 2013 at 11:29:47AM +0200, Johannes Berg wrote:
> Since "pairwise" is defined as an integer, the current
> assignment leads to it having the value 0 or 8, which
> is a bit strange in debug output:
> 
> WPA: Send EAPOL(version=2 secure=1 mic=1 ack=1 install=1 pairwise=8 kde_len=46 keyidx=2 encr=1)
> 
> Use !!(...) to normalize it to 0 or 1.

Thanks, applied.

Patch

diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c
index 4f1f6fb..4ecae2d 100644
--- a/src/ap/wpa_auth.c
+++ b/src/ap/wpa_auth.c
@@ -1232,7 +1232,7 @@  void __wpa_send_eapol(struct wpa_authenticator *wpa_auth,
 	else
 		version = WPA_KEY_INFO_TYPE_HMAC_MD5_RC4;
 
-	pairwise = key_info & WPA_KEY_INFO_KEY_TYPE;
+	pairwise = !!(key_info & WPA_KEY_INFO_KEY_TYPE);
 
 	wpa_printf(MSG_DEBUG, "WPA: Send EAPOL(version=%d secure=%d mic=%d "
 		   "ack=%d install=%d pairwise=%d kde_len=%lu keyidx=%d "