Discussion:
wpa_supplicant endian issue
(too old to reply)
Sean Boudreau
2007-04-25 13:43:34 UTC
Permalink
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));

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Sam Leffler
2007-04-26 16:11:03 UTC
Permalink
Post by Sean Boudreau
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?

Sam

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Sean Boudreau
2007-04-26 16:26:43 UTC
Permalink
Post by Sam Leffler
Post by Sean Boudreau
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

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Sam Leffler
2007-04-26 16:16:07 UTC
Permalink
Post by Sam Leffler
Post by Sean Boudreau
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

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Pavel Cahyna
2007-05-03 21:25:37 UTC
Permalink
Post by Sean Boudreau
Post by Sam Leffler
Post by Sean Boudreau
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.
Does this need a pull-up to the netbsd-4 branch?

Pavel

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Sean Boudreau
2007-05-04 15:47:23 UTC
Permalink
Post by Pavel Cahyna
Does this need a pull-up to the netbsd-4 branch?
Pavel
Sure.

-seanb

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...