Patchwork [09/15] rsn: Add debug code for pmksa cache.

login
register
mail settings
Submitter Ben Greear
Date March 6, 2014, 12:19 a.m.
Message ID <1394065200-20377-9-git-send-email-greearb@candelatech.com>
Download mbox | patch
Permalink /patch/327245/
State Rejected
Headers show

Comments

Ben Greear - March 6, 2014, 12:19 a.m.
From: Ben Greear <greearb@candelatech.com>

Dodgy radius server was causing failures.  This code was added
to debug the problem, but was never used as user figured out RADIUS
problem first.

Signed-hostap: Ben Greear <greearb@candelatech.com>
---
 src/rsn_supp/pmksa_cache.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
Jouni Malinen - Jan. 31, 2015, 11:06 p.m.
On Wed, Mar 05, 2014 at 04:19:54PM -0800, greearb@candelatech.com wrote:
> Dodgy radius server was causing failures.  This code was added
> to debug the problem, but was never used as user figured out RADIUS
> problem first.

>  src/rsn_supp/pmksa_cache.c |   22 ++++++++++++++++++++++
> @@ -321,6 +321,28 @@ struct rsn_pmksa_cache_entry * pmksa_cache_get(struct rsn_pmksa_cache *pmksa,
> +#if 0
> +	/* Verbose debugging, we failed to find the cache entry, so print out
> +	 * everything to figure out why.
> +	 */

I don't think I'll add this type of #if 0'ed code.

> +	wpa_printf(MSG_DEBUG, "RSN: pmksa-cache-get failed lookup, network-ctx: %p",
> +		   network_ctx);

I'm not sure pmksa_cache_get() is really the best place for printing
something like this (i.e., the caller could not that no PMKSA cache
entry was available).

> +	if (aa)
> +		wpa_printf(MSG_DEBUG, "RSN: aa: " MACSTR "", MAC2STR(aa));
> +	if (pmkid)
> +		wpa_hexdump(MSG_DEBUG, "RSN: pmkid",
> +			    pmkid, PMKID_LEN);
> +	entry = pmksa->pmksa;
> +	while (entry) {
> +		wpa_printf(MSG_DEBUG, "RSN: entry: %p  aa: " MACSTR
> +			   " network-ctx: %p",
> +			   MAC2STR(entry->aa), entry->network_ctx);
> +		wpa_hexdump(MSG_DEBUG, "RSN: pmkid",
> +			    entry->pmkid, PMKID_LEN);
> +		entry = entry->next;
> +	}

And this sounds quite excessive.. If PMKSA entries are needed for
something, they can be extracted through the control interface. Filling
the debug log with this type of information every time something tries
find a PMKSA cache entry sounds excessive.

Patch

diff --git a/src/rsn_supp/pmksa_cache.c b/src/rsn_supp/pmksa_cache.c
index 0960815..fbf0f96 100644
--- a/src/rsn_supp/pmksa_cache.c
+++ b/src/rsn_supp/pmksa_cache.c
@@ -321,6 +321,28 @@  struct rsn_pmksa_cache_entry * pmksa_cache_get(struct rsn_pmksa_cache *pmksa,
 			return entry;
 		entry = entry->next;
 	}
+
+#if 0
+	/* Verbose debugging, we failed to find the cache entry, so print out
+	 * everything to figure out why.
+	 */
+	wpa_printf(MSG_DEBUG, "RSN: pmksa-cache-get failed lookup, network-ctx: %p",
+		   network_ctx);
+	if (aa)
+		wpa_printf(MSG_DEBUG, "RSN: aa: " MACSTR "", MAC2STR(aa));
+	if (pmkid)
+		wpa_hexdump(MSG_DEBUG, "RSN: pmkid",
+			    pmkid, PMKID_LEN);
+	entry = pmksa->pmksa;
+	while (entry) {
+		wpa_printf(MSG_DEBUG, "RSN: entry: %p  aa: " MACSTR
+			   " network-ctx: %p",
+			   MAC2STR(entry->aa), entry->network_ctx);
+		wpa_hexdump(MSG_DEBUG, "RSN: pmkid",
+			    entry->pmkid, PMKID_LEN);
+		entry = entry->next;
+	}
+#endif
 	return NULL;
 }