Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Nov 2004 00:54:21 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 66073 for review
Message-ID:  <200411300054.iAU0sLMC048293@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=66073

Change 66073 by sam@sam_ebb on 2004/11/30 00:54:17

	o revert handling of probe request frames in station mode
	o improve power save debug msgs
	o remove new vs. existing in open auth debug msg

Affected files ...

.. //depot/projects/wifi/sys/net80211/ieee80211_input.c#20 edit

Differences ...

==== //depot/projects/wifi/sys/net80211/ieee80211_input.c#20 (text+ko) ====

@@ -838,7 +838,6 @@
     struct ieee80211_node *ni, int rssi, u_int32_t rstamp, u_int16_t seq,
     u_int16_t status)
 {
-	int allocbs;
 
 	switch (ic->ic_opmode) {
 	case IEEE80211_M_IBSS:
@@ -866,17 +865,14 @@
 			ni = ieee80211_dup_bss(ic->ic_sta, wh->i_addr2);
 			if (ni == NULL)
 				return;
-			allocbs = 1;
-		} else
-			allocbs = 0;
+		}
 		ni->ni_rssi = rssi;
 		ni->ni_rstamp = rstamp;
 		IEEE80211_SEND_MGMT(ic, ni,
 			IEEE80211_FC0_SUBTYPE_AUTH, seq + 1);
 		IEEE80211_DPRINTF(ic, IEEE80211_MSG_DEBUG | IEEE80211_MSG_AUTH,
-			"station %s %s authenticated (open)\n",
-			ether_sprintf(ni->ni_macaddr),
-			(allocbs ? "newly" : "already"));
+			"station %s authenticated (open)\n",
+			ether_sprintf(ni->ni_macaddr));
 		break;
 
 	case IEEE80211_M_STA:
@@ -1919,8 +1915,11 @@
 		break;
 	}
 
-	case IEEE80211_FC0_SUBTYPE_PROBE_REQ:
-		if (ic->ic_state != IEEE80211_S_RUN) {
+	case IEEE80211_FC0_SUBTYPE_PROBE_REQ: {
+		u_int8_t rate;
+
+		if (ic->ic_opmode == IEEE80211_M_STA ||
+		    ic->ic_state != IEEE80211_S_RUN) {
 			ic->ic_stats.is_rx_mgtdiscard++;
 			return;
 		}
@@ -1955,59 +1954,43 @@
 		IEEE80211_VERIFY_ELEMENT(ssid, IEEE80211_NWID_LEN);
 		IEEE80211_VERIFY_SSID(ic->ic_bss, ssid, "probe");
 
-		allocbs = 0;
-		switch (ic->ic_opmode) {
-		case IEEE80211_M_IBSS:
-		case IEEE80211_M_AHDEMO:
-			/*
-			 * XXX Cannot tell if the sender is operating
-			 * in ibss mode.  But we need a new node to
-			 * send the response so blindly add them to the
-			 * neighbor table.
-			 */
-			if (ni == ic->ic_bss) {
+		if (ni == ic->ic_bss) {
+			if (ic->ic_opmode == IEEE80211_M_IBSS) {
+				/*
+				 * XXX Cannot tell if the sender is operating
+				 * in ibss mode.  But we need a new node to
+				 * send the response so blindly add them to the
+				 * neighbor table.
+				 */
 				ni = ieee80211_fakeup_adhoc_node(ic->ic_sta,
 					wh->i_addr2);
-				if (ni == NULL)
-					return;
-				allocbs = 1;
-			}
-			break;
-		case IEEE80211_M_HOSTAP:
-			if (ni == ic->ic_bss) {
+			} else
 				ni = ieee80211_dup_bss(ic->ic_sta, wh->i_addr2);
-				if (ni == NULL)
-					return;
-				allocbs = 1;
-			}
-			break;
-		default:			/* silence compiler */
-			break;
-		}
+			if (ni == NULL)
+				return;
+			allocbs = 1;
+		} else
+			allocbs = 0;
 		IEEE80211_DPRINTF(ic, IEEE80211_MSG_ASSOC,
-			"%s: %sprobe req from %s\n", __func__,
-			allocbs ? "new" : "", ether_sprintf(wh->i_addr2));
+			"%s: probe req from %s\n", __func__,
+			ether_sprintf(wh->i_addr2));
 		ni->ni_rssi = rssi;
 		ni->ni_rstamp = rstamp;
-		if (ic->ic_opmode != IEEE80211_M_STA) {
-			u_int8_t rate;
-			/*
-			 * Calculate rate set for response.
-			 */
-			rate = ieee80211_setup_rates(ic, ni, rates, xrates,
-				  IEEE80211_F_DOSORT | IEEE80211_F_DOFRATE
-				| IEEE80211_F_DONEGO | IEEE80211_F_DODEL);
-			if (rate & IEEE80211_RATE_BASIC) {
-				IEEE80211_DPRINTF(ic, IEEE80211_MSG_XRATE,
-					"[%s] received rate set invalid\n",
-					ether_sprintf(wh->i_addr2));
-				if (allocbs)	/* reclaim immediately */
-					ieee80211_free_node(ni);
-			}
+		rate = ieee80211_setup_rates(ic, ni, rates, xrates,
+			  IEEE80211_F_DOSORT | IEEE80211_F_DOFRATE
+			| IEEE80211_F_DONEGO | IEEE80211_F_DODEL);
+		if (rate & IEEE80211_RATE_BASIC) {
+			IEEE80211_DPRINTF(ic, IEEE80211_MSG_XRATE,
+				"[%s] received rate set invalid\n",
+				ether_sprintf(wh->i_addr2));
+			if (allocbs)	/* reclaim immediately */
+				ieee80211_free_node(ni);
+		} else {
+			IEEE80211_SEND_MGMT(ic, ni,
+				IEEE80211_FC0_SUBTYPE_PROBE_RESP, 0);
 		}
-		IEEE80211_SEND_MGMT(ic, ni,
-			IEEE80211_FC0_SUBTYPE_PROBE_RESP, 0);
 		break;
+	}
 
 	case IEEE80211_FC0_SUBTYPE_AUTH: {
 		u_int16_t algo, seq, status;
@@ -2590,14 +2573,18 @@
 	 * in the packet dispatched to the station; otherwise
 	 * turn off the TIM bit.
 	 */
-	IEEE80211_DPRINTF(ic, IEEE80211_MSG_POWER,
-		"[%s] got ps-poll, send packet, %u still queued\n",
-		ether_sprintf(ni->ni_macaddr), qlen);
 	if (qlen != 0) {
+		IEEE80211_DPRINTF(ic, IEEE80211_MSG_POWER,
+			"[%s] got ps-poll, send packet, %u still queued\n",
+			ether_sprintf(ni->ni_macaddr), qlen);
 		wh = mtod(m, struct ieee80211_frame_min *);
 		wh->i_fc[1] |= IEEE80211_FC1_MORE_DATA;
-	} else
+	} else {
+		IEEE80211_DPRINTF(ic, IEEE80211_MSG_POWER,
+			"[%s] got ps-poll, send packet, queue empty\n",
+			ether_sprintf(ni->ni_macaddr));
 		ic->ic_set_tim(ic, ni, 0);
+	}
 	m->m_flags |= M_PWR_SAV;		/* bypass PS handling */
 	IF_ENQUEUE(&ic->ic_ifp->if_snd, m);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200411300054.iAU0sLMC048293>