Subject: Re: wpa_supplicant endian issue
To: Sam Leffler <sam@errno.com>
From: Sean Boudreau <seanb@qnx.com>
List: tech-net
Date: 04/26/2007 12:26:43
On Thu, Apr 26, 2007 at 09:16:07AM -0700, Sam Leffler wrote:
> Sam Leffler wrote:
> > Sean Boudreau wrote:
> >> Hi:
> >>
> >> I was unable to get authenticated on a big endian
> >> machine. Turns out the receive sequence counter
> >> is little endian on the wire. Are there any objections
> >> to the following before I commit?
> >>
> >> Regards,
> >>
> >> -seanb
> >>
> >>
> >> Index: driver_netbsd.c
> >> ===================================================================
> >> RCS file: /cvsroot/src/usr.sbin/wpa/wpa_supplicant/driver_netbsd.c,v
> >> retrieving revision 1.1
> >> diff -c -r1.1 driver_netbsd.c
> >> *** driver_netbsd.c 1 Oct 2005 18:50:12 -0000 1.1
> >> --- driver_netbsd.c 25 Apr 2007 13:04:55 -0000
> >> ***************
> >> *** 341,346 ****
> >> --- 341,347 ----
> >> wk.ik_keyix = IEEE80211_KEYIX_NONE;
> >> wk.ik_keylen = key_len;
> >> memcpy(&wk.ik_keyrsc, seq, seq_len);
> >> + wk.ik_keyrsc = le64toh(wk.ik_keyrsc);
> >> memcpy(wk.ik_keydata, key, key_len);
> >>
> >> return set80211var(drv, IEEE80211_IOC_WPAKEY, &wk, sizeof(wk));
> >>
> >>
> >
> > This should not be needed. What driver is being used?
>
> I take it back; the rx sequence number is used in host byte order in
> net80211 so this is required. Weird, I'm sure I tested this on
> big-endian machines...
>
> Sam
It worked for me the first time when the rsc was 0 but not
thereafter.
Committed.
Regards,
-seanb