git: 9front

Download patch

ref: 74b9943b9cfb060b95ea607117c89f2fef2c734c
parent: 68deae166d643538b36d89ecf48ec4af755f5e50
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Fri Jun 21 21:22:57 EDT 2013

wifi: add list of setup encryption key ciphers and lengths into ifstats file

it is usefull to see what encryption keys have been
estabished by aux/wpa.

--- a/sys/src/9/pc/wifi.c
+++ b/sys/src/9/pc/wifi.c
@@ -660,6 +660,7 @@
 	char *s, *p, *e;
 	Wnode *wn;
 	long now;
+	int i;
 
 	p = s = smalloc(4096);
 	e = s + 4096;
@@ -670,9 +671,16 @@
 	wn = wifi->bss;
 	if(wn != nil){
 		p = seprint(p, e, "bssid: %E\n", wn->bssid);
-		if(wn->brsnelen > 0){
-			int i;
 
+		/* only print key ciphers and key length */
+		for(i = 0; i<nelem(wn->rxkey); i++)
+			p = seprint(p, e, "rxkey%d: %s:[%d]\n", i,
+				ciphers[wn->rxkey[i].cipher], wn->rxkey[i].len);
+		for(i = 0; i<nelem(wn->txkey); i++)
+			p = seprint(p, e, "txkey%d: %s:[%d]\n", i,
+				ciphers[wn->txkey[i].cipher], wn->txkey[i].len);
+
+		if(wn->brsnelen > 0){
 			p = seprint(p, e, "brsne: ");
 			for(i=0; i<wn->brsnelen; i++)
 				p = seprint(p, e, "%.2X", wn->brsne[i]);
--