PERFORCE change 43951 for review

Sam Leffler sam at FreeBSD.org
Mon Dec 15 11:44:39 PST 2003


http://perforce.freebsd.org/chv.cgi?CH=43951

Change 43951 by sam at sam_ebb on 2003/12/15 11:43:52

	o fix station-side shared key authentication: add missing
	  auth challenge frame send
	o fixup some debug msgs related to shared key authentication

Affected files ...

.. //depot/projects/netperf/sys/net80211/ieee80211_input.c#18 edit

Differences ...

==== //depot/projects/netperf/sys/net80211/ieee80211_input.c#18 (text+ko) ====

@@ -784,7 +784,7 @@
 		IEEE80211_SEND_MGMT(ic, ni,
 			IEEE80211_FC0_SUBTYPE_AUTH, seq + 1);
 		if (ifp->if_flags & IFF_DEBUG)
-			if_printf(ifp, "station %s %s authenticated\n",
+			if_printf(ifp, "station %s %s authenticated (open)\n",
 			    ether_sprintf(ni->ni_macaddr),
 			    (allocbs ? "newly" : "already"));
 		break;
@@ -797,7 +797,7 @@
 		}
 		if (status != 0) {
 			if_printf(&ic->ic_if,
-			    "authentication failed (reason %d) for %s\n",
+			    "open authentication failed (reason %d) for %s\n",
 			    status,
 			    ether_sprintf(wh->i_addr3));
 			if (ni != ic->ic_bss)
@@ -829,7 +829,7 @@
 	}
 
 	if (frm + 1 < efrm) {
-		if ((frm[1] + 2) > (efrm - frm)) {
+		if (frm[1] + 2 > efrm - frm) {
 			IEEE80211_DPRINTF(("elt %d %d bytes too long\n",
 			    frm[0], (frm[1] + 2) - (efrm - frm)));
 			return;
@@ -893,6 +893,11 @@
 			for (i = IEEE80211_CHALLENGE_LEN / sizeof(u_int32_t);
 			     --i >= 0; )
 				ni->ni_challenge[i] = arc4random();
+			if (ifp->if_flags & IFF_DEBUG)
+				if_printf(ifp, "station %s shared key "
+					"%sauthentication\n",
+					ether_sprintf(ni->ni_macaddr),
+					allocbs ? "" : "re");
 			break;
 		case IEEE80211_AUTH_SHARED_RESPONSE:
 			if (ni == ic->ic_bss) {
@@ -900,7 +905,6 @@
 				    __func__));
 				return;
 			}
-			allocbs = 1;
 			if (ni->ni_challenge == NULL) {
 				IEEE80211_DPRINTF((
 				    "%s: no challenge recorded\n", __func__));
@@ -912,6 +916,10 @@
 				    __func__));
 				return;
 			}
+			if (ifp->if_flags & IFF_DEBUG)
+				if_printf(ifp, "station %s authenticated "
+					"(shared key)\n",
+					ether_sprintf(ni->ni_macaddr));
 			break;
 		default:
 			IEEE80211_DPRINTF(("%s: bad seq %d from %s\n",
@@ -920,10 +928,6 @@
 		}
 		IEEE80211_SEND_MGMT(ic, ni,
 			IEEE80211_FC0_SUBTYPE_AUTH, seq + 1);
-		if (ifp->if_flags & IFF_DEBUG)
-			if_printf(ifp, "station %s %s authenticated\n",
-			    ether_sprintf(ni->ni_macaddr),
-			    (allocbs ? "newly" : "already"));
 		break;
 
 	case IEEE80211_M_STA:
@@ -937,7 +941,8 @@
 			}
 			if (status != 0) {
 				if_printf(&ic->ic_if,
-				    "%s: auth failed (reason %d) for %s\n",
+				    "%s: shared authentication failed "
+				    "(reason %d) for %s\n",
 				    __func__, status,
 				    ether_sprintf(wh->i_addr3));
 				if (ni != ic->ic_bss)
@@ -958,6 +963,8 @@
 				return;
 			}
 			memcpy(ni->ni_challenge, &challenge[2], challenge[1]);
+			IEEE80211_SEND_MGMT(ic, ni,
+				IEEE80211_FC0_SUBTYPE_AUTH, seq + 1);
 			break;
 		default:
 			IEEE80211_DPRINTF(("%s: bad seq %d from %s\n",
@@ -1260,7 +1267,8 @@
 			ieee80211_auth_open(ic, wh, ni, rssi, rstamp, seq,
 			    status);
 		else {
-			IEEE80211_DPRINTF(("%s: unsupported auth %d from %s\n",
+			IEEE80211_DPRINTF(("%s: unsupported authentication "
+				"algorithm %d from %s\n",
 				__func__, algo, ether_sprintf(wh->i_addr2)));
 			ic->ic_stats.is_rx_auth_unsupported++;
 			return;


More information about the p4-projects mailing list