After a few debugging session, I finally found the the problem.

In the ieee80211_copy_snap() function in ieee80211_tx.c, the data pointer
lands on odd address. Later when ethertype is assigned, one byte is
chopped off. That is why 0x06 is in the place of 0x08.

The attached patch fixed this problem.

However, I now face a bunch of frame errors on the receiving, which
seems to suggest I have similar unaligned access problems on the receving
side. More debugging.

However, I am really surprised why I hit this problem. Does anybody else
have the same unaligned access in the skb->data buffer? Strange indeed.
You would think ieee80211 code is already tested on thousands of different
machines...

Cheers.

Jun

On Thu, Oct 25, 2007 at 08:53:25PM -0700, Jun Sun wrote:
> 
> I did a little more digging. Apparently this is a valid ARP packet,
> except the ethertype is wrong. It should be 0x0806, instead of 0x0600.
> 
> Anybody has any clue here? Is it a problem in softMAC?
> 
> Cheers.
> 
> Jun
> 
> On Wed, Oct 24, 2007 at 11:23:22PM -0700, Jun Sun wrote:
> > 
> > I am running 2.6.21 on a ARM7 MMU-less CPU. I back-ported zd1211rw driver
> > from 2.6.23 kernel in order to support AL2230S_RF in a Airlink 101 stick.
> > 
> > Everything seems to be up and running find with iwconfig and ifconfig.
> > (I had some issues with WEP key, but for now I made AP open).
> > 
> > However, when I try to ping from the board to the LAN, I got
> > some weired packets on the network. See below. Specifically, 
> > the ethertype is 0x0600. Very strange. 
> > 
> > Can someone shed some light on this issue?
> > 
> > Cheers.
> > 
> > Jun
> > 
> > --------------
> > (NOTE: 00:11:a3:03:bc:9a is my wifi usb stick)
> > 
> > 23:12:07.043794 00:11:a3:03:bc:9a > Broadcast, ethertype NS (0x0600), 
> > length 60: 
> >         0x0000:  0001 0800 0604 0001 0011 a303 bc9a c0a8  ................
> >         0x0010:  017c 0000 0000 0000 c0a8 0101 0000 0000  .|..............
> >         0x0020:  0000 0000 0000 0000 0000 0000 0000       ..............
> > 23:12:07.490993 arp who-has 192.168.1.122 (Broadcast) tell 192.168.1.254
> > 23:12:08.129835 00:11:a3:03:bc:9a > Broadcast, ethertype NS (0x0600), 
> > length 60: 
> >         0x0000:  0001 0800 0604 0001 0011 a303 bc9a c0a8  ................
> >         0x0010:  017c 0000 0000 0000 c0a8 0101 0000 0000  .|..............
> >         0x0020:  0000 0000 0000 0000 0000 0000 0000       ..............
> > 23:12:08.492688 arp who-has 192.168.1.122 (Broadcast) tell 192.168.1.254
> > 23:12:09.217643 00:11:a3:03:bc:9a > Broadcast, ethertype NS (0x0600), 
> > length 60: 
> >         0x0000:  0001 0800 0604 0001 0011 a303 bc9a c0a8  ................
> >         0x0010:  017c 0000 0000 0000 c0a8 0101 0000 0000  .|..............
> >         0x0020:  0000 0000 0000 0000 0000 0000 0000       ..............
> > 23:12:09.498076 arp who-has 192.168.1.123 (Broadcast) tell 192.168.1.254
> > 23:12:09.498100 arp reply 192.168.1.123 is-at 00:60:08:3a:73:37
> > 23:12:09.506017 arp who-has 192.168.1.124 (Broadcast) tell 192.168.1.254
> > 23:12:10.510566 arp who-has 192.168.1.124 (Broadcast) tell 192.168.1.254
> > 23:12:10.703985 00:11:a3:03:bc:9a > Broadcast, ethertype NS (0x0600), 
> > length 60: 
> >         0x0000:  0001 0800 0604 0001 0011 a303 bc9a c0a8  ................
> >         0x0010:  017c 0000 0000 0000 c0a8 0101 0000 0000  .|..............
> >         0x0020:  0000 0000 0000 0000 0000 0000 0000       ..............
> > 23:12:11.515996 arp who-has 192.168.1.125 (Broadcast) tell 192.168.1.254
> > 23:12:11.799559 00:11:a3:03:bc:9a > Broadcast, ethertype NS (0x0600), 
> > length 60: 
> >         0x0000:  0001 0800 0604 0001 0011 a303 bc9a c0a8  ................
> >         0x0010:  017c 0000 0000 0000 c0a8 0101 0000 0000  .|..............
> >         0x0020:  0000 0000 0000 0000 0000 0000 0000       ..............
> > 23:12:12.519093 arp who-has 192.168.1.125 (Broadcast) tell 192.168.1.254
> > 23:12:12.890384 00:11:a3:03:bc:9a > Broadcast, ethertype NS (0x0600), 
> > length 60: 
> >         0x0000:  0001 0800 0604 0001 0011 a303 bc9a c0a8  ................
> >         0x0010:  017c 0000 0000 0000 c0a8 0101 0000 0000  .|..............
> >         0x0020:  0000 0000 0000 0000 0000 0000 0000       ..............
> > 
> > 
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems?  Stop.
> > Now Search log events and configuration files using AJAX and a browser.
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > _______________________________________________
> > Zd1211-devs mailing list - http://zd1211.wiki.sourceforge.net/
> > Unsubscribe: https://lists.sourceforge.net/lists/listinfo/zd1211-devs
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Zd1211-devs mailing list - http://zd1211.wiki.sourceforge.net/
> Unsubscribe: https://lists.sourceforge.net/lists/listinfo/zd1211-devs
diff -Nru ./net/ieee80211/ieee80211_tx.c.orig ./net/ieee80211/ieee80211_tx.c
--- ./net/ieee80211/ieee80211_tx.c.orig 2007-04-25 20:08:32.000000000 -0700
+++ ./net/ieee80211/ieee80211_tx.c      2007-10-27 21:48:24.000000000 -0700
@@ -130,6 +130,7 @@
 {
        struct ieee80211_snap_hdr *snap;
        u8 *oui;
+       u16 temp;
 
        snap = (struct ieee80211_snap_hdr *)data;
        snap->dsap = 0xaa;
@@ -144,7 +145,9 @@
        snap->oui[1] = oui[1];
        snap->oui[2] = oui[2];
 
-       *(u16 *) (data + SNAP_SIZE) = htons(h_proto);
+       // *(u16 *) (data + SNAP_SIZE) = htons(h_proto);
+       temp = htons(h_proto);
+       memcpy(data + SNAP_SIZE, &temp, sizeof(u16));
 
        return SNAP_SIZE + sizeof(u16);
 }
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Zd1211-devs mailing list - http://zd1211.wiki.sourceforge.net/
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/zd1211-devs

Reply via email to