PERFORCE change 42669 for review

Sam Leffler sam at FreeBSD.org
Mon Nov 17 09:37:10 PST 2003


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

Change 42669 by sam at sam_ebb on 2003/11/17 09:36:32

	o change diag ioctl to not copyout unless a pointer was
	  returned and to always return the size retrieved from the
	  HAL; this allows users to pass in a null pointer and a large
	  size to find out the "right size" for an item they want to
	  retrieve
	o fix WEP use in hostap mode; need to reset the pointer to the
	  802.11 packet header after stripping the WEP header on input
	o move rate control change messages under ath_debug; they were
	  left on to be annoying and motivate someone to do a good
	  algorithm but it looks like noone's going to step up

Affected files ...

.. //depot/projects/netperf/sys/dev/ath/if_ath.c#37 edit

Differences ...

==== //depot/projects/netperf/sys/dev/ath/if_ath.c#37 (text+ko) ====

@@ -915,11 +915,10 @@
 		u_int size;
 
 		if (ath_hal_getdiagstate(ah, ad->ad_id, &data, &size)) {
-			if (size > ad->ad_size)
-				size = ad->ad_size;
-			error = copyout(data, ad->ad_data, size);
-			if (error == 0)
+			if (size < ad->ad_size)
 				ad->ad_size = size;
+			if (data)
+				error = copyout(data, ad->ad_data, ad->ad_size);
 		} else
 			error = EINVAL;
 		break;
@@ -1729,7 +1728,8 @@
 			wh->i_fc[1] &= ~IEEE80211_FC1_WEP;
 			memcpy(&whbuf, wh, sizeof(whbuf));
 			m_adj(m, IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN);
-			memcpy(mtod(m, caddr_t), &whbuf, sizeof(whbuf));
+			wh = mtod(m, struct ieee80211_frame *);
+			memcpy(wh, &whbuf, sizeof(whbuf));
 			/*
 			 * Also trim WEP ICV from the tail.
 			 */
@@ -2765,11 +2765,11 @@
 	}
 
 	if (ni->ni_txrate != orate) {
-		printf("%s: %dM -> %dM (%d ok, %d err, %d retr)\n",
+		DPRINTF(("%s: %dM -> %dM (%d ok, %d err, %d retr)\n",
 		    __func__,
 		    (rs->rs_rates[orate] & IEEE80211_RATE_VAL) / 2,
 		    (rs->rs_rates[ni->ni_txrate] & IEEE80211_RATE_VAL) / 2,
-		    an->an_tx_ok, an->an_tx_err, an->an_tx_retr);
+		    an->an_tx_ok, an->an_tx_err, an->an_tx_retr));
 	}
 	if (ni->ni_txrate != orate || enough)
 		an->an_tx_ok = an->an_tx_err = an->an_tx_retr = 0;


More information about the p4-projects mailing list