Subject: wi(4) interoperability, 104bit WEP key patch
To: None <current-users@netbsd.org, netbsd@re.soum.co.jp, netbsd-pcmcia@kaynet.or.jp>
From: FUKAUMI Naoki <naoki@fukaumi.org>
List: current-users
Date: 12/31/2001 03:17:03
This is wi(4) interoperability (mainly, peer to peer mode) test notes.

I have two wi(4) devices. Major functions are...

  WiFi standards compliant
  IEEE 802.11b compliant, support TX rate up to 11Mbps
  40bit (64bit) and 104bit (128bit) WEP key support
  Infrastructure mode and peer to peer mode support

Major difference of my two cards are, one has Agere (Lucent) chip, and
another has Intersil prism 2.5 chip.

(I haven't any wireless AP (router, bridge) device :)

dmesg (some modified):
[Agere]
pcmcia0: CIS version PC Card Standard 5.0
pcmcia0: CIS info: MELCO, WLI-PCM-L11, Version 01.01, 
pcmcia0: Manufacturer code 0x156, product 0x2
pcmcia0: function 0: network adapter, ccr addr 3e0 mask 1
pcmcia0: function 0, config table entry 1: I/O card; irq mask ffff; iomask 6, iospace 0-3f; io16 irqpulse irqlevel
wi0 at pcmcia0 function 0: MELCO, WLI-PCM-L11, Version 01.01
wi0: 802.11 address **:**:**:**:**:**
wi0: using Lucent chip or unknown chip, Firmware: 8.10 variant 1

[Intersil]
pcmcia0: CIS version PC Card Standard 5.0
pcmcia0: CIS info: BUFFALO, WLI-CF-S11G, , 
pcmcia0: Manufacturer code 0x26f, product 0x30b
pcmcia0: function 0: network adapter, ccr addr 3e0 mask 1
pcmcia0: function 0, config table entry 1: I/O card; irq mask ffff; iomask 6, iospace 0-3f; io16 irqshare irqpulse irqlevel
wi0 at pcmcia0 function 0: BUFFALO, WLI-CF-S11G, 
wi0: 802.11 address **:**:**:**:**:**
wi0: using RF:PRISM2.5 MAC:ISL3873, Firmware: 1.3 variant 4

SECTION 1: Ad-hoc demo mode (Old ad-hoc mode)

Agere and Intersil chip support Ad-hoc demo mode. (Recent MS Windows
driver seems to be NOT supported this mode)

To use,
# wiconfig wi0 -p 3

In Ad-hoc mode, BSSID is
# wiconfig wi0
  :
Current BSSID:				[ 00:00:00:00:00:00 ]
  :

SECTION 2: IBSS mode (New, IEEE 802.11 compliant IBSS ad-hoc mode)

*** some vendor may call this "peer to peer" or "Ad-hoc" ;) mode ***

With Agere chip, need firmware version >= 6.16.

To use,
# wiconfig wi0 -p 1 (default)
# wiconfig wi0 -c 1

BSSID is random and changes cyclic, until link with another stations.

With Intersil chip, need firmware version >= 0.8.

To use,
# wiconfig wi0 -p 0 (undocumented params...)
If you get "wiconfig: SIOCSWAVELAN: Invalid argument", do
# wiconfig wi0 -p 1
then try again
# wiconfig wi0 -p 0

If another station is not present, BSSID is fixed id. Otherwise, BSSID
is another station's BSSID.

SECTION 3: BSS mode (Infrastructure mode)

To use,
# wiconfig wi0 -p 1 (default)

BSSID is [ 44:44:44:44:44:44 ] until link with another stations.

Agere BSS mode seems to be able to link with Intersil IBSS stations.
Intersil BSS mode can't link with Agere IBSS stations.
(Not tested: Agere BSS with Agere IBSS, Intersil BSS with Intersil IBSS)

Intersil Ad-hoc mode can get Agere IBSS station's BSSID. But if Agere
station is not link with another (I)BSS station, Agere's BSSID will be
changed, and Intersil station can't follow BSSID change automatically.
So Intersil Ad-hoc mode can't link with Agere IBSS station long time.

SECTION 4: WEP

40bit WEP key works fine between Agere and Intersil stations.

-current wi(4) code only use 40bit WEP key for Intersil chips. Below is
AD-HOC (no IEEE compliant? :) patch to use 104bit WEP key.

After this patch, 104bit WEP key works fine between Agere and Intersil.

(wiconfig(8) accept 112bit (14 char/ 28 hex) key. But last 8bit will
 be ignored. wiconfig.c should be fixed only accept 104bit key! ;)

--- /home/fun/src/sys/dev/ic/wi.c	Mon Nov 19 17:30:32 2001
+++ wi.c	Sun Dec 30 22:57:04 2001
@@ -873,10 +873,10 @@
 			struct wi_ltv_str	ws;
 			struct wi_ltv_keys	*wk = (struct wi_ltv_keys *)ltv;
 			for (i = 0; i < 4; i++) {
-				ws.wi_len = 4;
+				ws.wi_len = 8;
 				ws.wi_type = WI_RID_P2_CRYPT_KEY0 + i;
-				memcpy(ws.wi_str, &wk->wi_keys[i].wi_keydat, 5);
-				ws.wi_str[5] = '\0';
+				memcpy(ws.wi_str, &wk->wi_keys[i].wi_keydat, 13);
+				ws.wi_str[13] = '\0';
 				error = wi_write_record(sc,
 				    (struct wi_ltv_gen *)&ws);
 				if (error)

SECTION 5: Firmware version

-current wi(4) code doesn't show firmware version of Agere chips.
Patch is below. (Test my two cards only)

--- wi.c.orig	Sun Dec 30 22:57:04 2001
+++ wi.c	Sun Dec 30 23:13:06 2001
@@ -1913,24 +1913,27 @@
 		sc->sc_prism2 = 1;
 		break;
 	default:
-		printf("Lucent chip or unknown chip\n");
+		printf("Lucent chip or unknown chip");
 		sc->sc_prism2 = 0;
 		break;
 	}
 
+	/* try to get firm version */
+	memset(&ver, 0, sizeof(ver));
+	ver.wi_type = WI_RID_STA_IDENTITY;
+	ver.wi_len = 5;
+	wi_read_record(sc, (struct wi_ltv_gen *)&ver);
+	LE16TOH(ver.wi_ver[1]);
+	LE16TOH(ver.wi_ver[2]);
+	LE16TOH(ver.wi_ver[3]);
 	if (sc->sc_prism2) {
-		/* try to get prism2 firm version */
-		memset(&ver, 0, sizeof(ver));
-		ver.wi_type = WI_RID_STA_IDENTITY;
-		ver.wi_len = 5;
-		wi_read_record(sc, (struct wi_ltv_gen *)&ver);
-		LE16TOH(ver.wi_ver[1]);
-		LE16TOH(ver.wi_ver[2]);
-		LE16TOH(ver.wi_ver[3]);
 		printf(", Firmware: %i.%i variant %i\n", ver.wi_ver[2],
 		       ver.wi_ver[3], ver.wi_ver[1]);
 		sc->sc_prism2_ver = ver.wi_ver[2] * 100 +
 				    ver.wi_ver[3] *  10 + ver.wi_ver[1];
+	} else {
+		printf(", Firmware: %i.%02i variant %i\n", ver.wi_ver[2],
+		       ver.wi_ver[3], ver.wi_ver[1]);
 	}
 
 	return;

SECTION 6: info

[Agere firmware]
  ftp://ftp.orinocowireless.com/pub/software/ORiNOCO/PC_Card/Firmware/R7.4winter2002/Readme.txt
  ftp://ftp.orinocowireless.com/pub/software/ORiNOCO/PC_Card/Firmware/R7.0spring2001/Readme.txt

[Misc]
  http://ozlabs.org/people/dgibson/dldwd/ (testing/orinoco.c)

-- 
FUKAUMI Naoki