PERFORCE change 65690 for review

Sam Leffler sam at FreeBSD.org
Tue Nov 23 03:55:58 GMT 2004


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

Change 65690 by sam at sam_ebb on 2004/11/23 03:55:35

	checkpoint wme support

Affected files ...

.. //depot/projects/wifi/sbin/ifconfig/ifieee80211.c#15 edit

Differences ...

==== //depot/projects/wifi/sbin/ifconfig/ifieee80211.c#15 (text+ko) ====

@@ -481,6 +481,42 @@
 	}
 }
 
+static void
+set80211cwmin(const char *val, int d, int s, const struct afswtch *rafp)
+{
+	set80211(s, IEEE80211_IOC_WME_CWMIN, atoi(val), 0, NULL);
+}
+
+static void
+set80211cwmax(const char *val, int d, int s, const struct afswtch *rafp)
+{
+	set80211(s, IEEE80211_IOC_WME_CWMAX, atoi(val), 0, NULL);
+}
+
+static void
+set80211aifs(const char *val, int d, int s, const struct afswtch *rafp)
+{
+	set80211(s, IEEE80211_IOC_WME_AIFS, atoi(val), 0, NULL);
+}
+
+static void
+set80211txoplimit(const char *val, int d, int s, const struct afswtch *rafp)
+{
+	set80211(s, IEEE80211_IOC_WME_TXOPLIMIT, atoi(val), 0, NULL);
+}
+
+static void
+set80211acm(const char *val, int d, int s, const struct afswtch *rafp)
+{
+	set80211(s, IEEE80211_IOC_WME_ACM, atoi(val), 0, NULL);
+}
+
+static void
+set80211ackpolicy(const char *val, int d, int s, const struct afswtch *rafp)
+{
+	set80211(s, IEEE80211_IOC_WME_ACKPOLICY, d, 0, NULL);
+}
+
 static int
 getmaxrate(uint8_t rates[15], uint8_t nrates)
 {
@@ -697,6 +733,32 @@
 	list_scan(s);
 }
 
+/* unalligned little endian access */     
+#define LE_READ_4(p)					\
+	((u_int32_t)					\
+	 ((((const u_int8_t *)(p))[0]      ) |		\
+	  (((const u_int8_t *)(p))[1] <<  8) |		\
+	  (((const u_int8_t *)(p))[2] << 16) |		\
+	  (((const u_int8_t *)(p))[3] << 24)))
+
+static int __inline
+iswpaoui(const u_int8_t *frm)
+{
+	return frm[1] > 3 && LE_READ_4(frm+2) == ((WPA_OUI_TYPE<<24)|WPA_OUI);
+}
+
+static int __inline
+iswmeoui(const u_int8_t *frm)
+{
+	return frm[1] > 3 && LE_READ_4(frm+2) == ((WME_OUI_TYPE<<24)|WME_OUI);
+}
+
+static int __inline
+isatherosoui(const u_int8_t *frm)
+{
+	return frm[1] > 3 && LE_READ_4(frm+2) == ((ATH_OUI_TYPE<<24)|ATH_OUI);
+}
+
 static void
 list_stations(int s)
 {
@@ -732,6 +794,7 @@
 	do {
 		struct ieee80211req_sta_info *si;
 		uint8_t *vp;
+		int ielen;
 
 		si = (struct ieee80211req_sta_info *) cp;
 		vp = (u_int8_t *)(si+1);
@@ -742,26 +805,29 @@
 			, (si->isi_rates[si->isi_txrate] & IEEE80211_RATE_VAL)/2
 			, si->isi_rssi
 			, si->isi_inact
-			, si->isi_txseq
-			, si->isi_rxseq
+			, si->isi_txseqs[0]
+			, si->isi_rxseqs[0]
 			, getcaps(si->isi_capinfo)
 			, si->isi_erp
 		);
 
-		if (si->isi_ie_len > 0) {
+		for (ielen = si->isi_ie_len; ielen > 0; ielen -= 2+vp[1])
 			switch (vp[0]) {
 			case IEEE80211_ELEMID_VENDOR:
-				if (vp[1] < 2 + 4 ||
-				    memcmp(&vp[2], "\x00\x50\xf2\x01", 4) != 0)
-					break;
-				printie(" WPA", vp, 2+vp[1], 24);
+				if (iswpaoui(vp))
+					printie(" WPA", vp, 2+vp[1], 24);
+				else if (iswmeoui(vp))
+					printie(" WME", vp, 2+vp[1], 24);
+				else
+					printie(" VEN", vp, 2+vp[1], 24);
 				break;
 			case IEEE80211_ELEMID_RSN:
 				printie(" RSN", vp, 2+vp[1], 24);
 				break;
-			/* XXX WME */
+			default:
+				printie(" ???", vp, 2+vp[1], 24);
+				break;
 			}
-		}
 		printf("\n");
 		cp += si->isi_len, len -= si->isi_len;
 	} while (len >= sizeof(struct ieee80211req_sta_info));
@@ -828,7 +894,8 @@
 
 #define	IEEE80211_C_BITS \
 "\020\1WEP\2TKIP\3AES\4AES_CCM\6CKIP\11IBSS\12PMGT\13HOSTAP\14AHDEMO" \
-"\15SWRETRY\16TXPMGT\17SHSLOT\20SHPREAMBLE\21MONITOR\22TKIPMIC\30WPA1\31WPA2"
+"\15SWRETRY\16TXPMGT\17SHSLOT\20SHPREAMBLE\21MONITOR\22TKIPMIC\30WPA1" \
+"\31WPA2\32BURST\33WME"
 
 static void
 list_capabilities(int s)
@@ -1236,10 +1303,10 @@
 	ireq.i_type = IEEE80211_IOC_WME;
 	if (ioctl(s, SIOCG80211, &ireq) != -1) {
 		if (ireq.i_val) {
-			printf("%cwme ENA", spacer);
+			printf("%cwme", spacer);
 			spacer = ' ';
 		} else if (verbose) {
-			printf("%cwme DIS", spacer);
+			printf("%c-wme", spacer);
 			spacer = ' ';
 		}
 	}
@@ -1259,10 +1326,10 @@
 		ireq.i_type = IEEE80211_IOC_APBRIDGE;
 		if (ioctl(s, SIOCG80211, &ireq) != -1) {
 			if (!ireq.i_val) {
-				printf("%capbridge DIS", spacer);
+				printf("%c-apbridge", spacer);
 				spacer = ' ';
 			} else if (verbose) {
-				printf("%capbridge ENA", spacer);
+				printf("%capbridge", spacer);
 				spacer = ' ';
 			}
 		}
@@ -1297,10 +1364,10 @@
 		ireq.i_type = IEEE80211_IOC_COUNTERMEASURES;
 		if (ioctl(s, SIOCG80211, &ireq) != -1) {
 			if (ireq.i_val) {
-				printf("%ccountermeasures ENA", spacer);
+				printf("%ccountermeasures", spacer);
 				spacer = ' ';
 			} else if (verbose) {
-				printf("%ccountermeasures DIS", spacer);
+				printf("%c-countermeasures", spacer);
 				spacer = ' ';
 			}
 		}
@@ -1472,6 +1539,13 @@
 	{ "ap",		NEXTARG,	set80211bssid },
 	{ "scan",	0,		set80211scan },
 	{ "list",	NEXTARG,	set80211list },
+	{ "cwmin",	NEXTARG,	set80211cwmin },
+	{ "cwmax",	NEXTARG,	set80211cwmax },
+	{ "aifs",	NEXTARG,	set80211aifs },
+	{ "txoplimit",	NEXTARG,	set80211txoplimit },
+	{ "acm",	NEXTARG,	set80211acm },
+	{ "ack",	1,		set80211ackpolicy },
+	{ "-ack",	0,		set80211ackpolicy },
 };
 static struct afswtch af_ieee80211 = {
 	.af_name	= "ieee80211",


More information about the p4-projects mailing list