From: "Arend van Spriel" <arend@broadcom.com>
To: "Mathieu Devos" <mathieu.devos@ugent.be>
Cc: linux-wireless@vger.kernel.org
Subject: Re: Skb and ieee80211 headers
Date: Wed, 31 Jul 2013 17:04:15 +0200 [thread overview]
Message-ID: <51F9276F.1040908@broadcom.com> (raw)
In-Reply-To: <CAE_+Soy4Hy+uMAsn30PX9QpqY=Jah2f5qUCa=MkCskJczQB05w@mail.gmail.com>
On 07/31/2013 03:45 PM, Mathieu Devos wrote:
> Alright,
>
> Seems like I have fixed some issues while added some others. Since I
> assume that when my hook gets activated the data pointer should be at
> the start of the 802.3 header I casted an ethhdr (8023) on top of that
> and it seems that on my notebook this is handled correctly (I can
> actually check on my own mac addr and see that these frames are
> for/from me).
How does your hook work? Are you intercepting packets?
Regards,
Arend
> On Wed, Jul 31, 2013 at 2:55 PM, Arend van Spriel <arend@broadcom.com> wrote:
>> On 07/31/2013 02:39 PM, Mathieu Devos wrote:
>>>
>>> Hi,
>>>
>>> The wireless chip is a Broadcast BCM4330 chip. After looking around a
>>> bit I found that this is a fullMAC and links to the driver on
>>> wireless.kernel: http://wireless.kernel.org/en/users/Drivers/brcm80211
>>> and also links directly to android itself:
>>> https://android.googlesource.com/platform/hardware/broadcom/wlan
>>
>>
>> I suspected. The bcm4330 is indeed a fullmac device, which means the 802.11
>> stack is running on the device. The driver on Android is located under:
>>
>> https://android.googlesource.com/kernel/samsung/+/android-samsung-3.0-ics-mr1/drivers/net/wireless/bcmdhd/
>>
>> Not sure which android version you have.
>>
>> The brcm80211 on wireless.kernel.org is the upstream linux driver.
>>
>> Gr. AvS
>>
>>
>>> Still trying to learn a lot in this tightly packed world of protocol
>>> stacks, wireless and all the other poisons. Seems like I still have a
>>> long way to go. Thank you already for helping me out with these issues
>>> and taking the time to explain these things to me.
>>>
>>> Kind regards,
>>> Mathieu Devos
>>>
>>> On Wed, Jul 31, 2013 at 1:05 PM, Arend van Spriel <arend@broadcom.com>
>>> wrote:
>>>>
>>>> On 07/31/2013 12:28 PM, Mathieu Devos wrote:
>>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>> It's an android smartphone (I 9100 - Samsung galaxy S2) so it does not
>>>>> have a normal ethernet 802.3 input even. I check before selecting the
>>>>> device that it's wireless (through ieee80211_ptr) and this properly
>>>>> returns the wlan0 device which should be on the 80211 standard.
>>>>
>>>>
>>>>
>>>> *sigh* Welcome in the world of protocol stacks, wireless, networking
>>>> (choose
>>>> your poison). Let me draw the picture.
>>>>
>>>> o user-space
>>>> |
>>>> ----------------------
>>>> | kernel
>>>> +-----------+
>>>> | NET | networking subsystem, ie. TCP/IP stack
>>>> +-----------+
>>>> | 802.3
>>>> +----------------+
>>>> | | driver |
>>>> | +------------+ |
>>>> | |802.11 stack| |
>>>> | +------------+ |
>>>> | | 802.11 |
>>>> +----------------+
>>>> |
>>>> o RF
>>>>
>>>> The device hooks up to the networking subsystem as an ethernet device and
>>>> as
>>>> such it receives 802.3 packets. These are converted to 802.11 packets by
>>>> the
>>>> 802.11 stack. Now depending on your device that happens in the device
>>>> driver
>>>> or on the device itself. Another option is that this is done by mac80211
>>>> (kernel provided 802.11 stack), but that is probably not the case, but to
>>>> be
>>>> sure I ask again: what wireless device do you have in your galaxy S2?
>>>>
>>>> Gr. AvS
>>>>
>>>>
>>>>> My goal is to get the ieee80211_header properly on the skb with this
>>>>> device, but some of the pointers and original data in the skb seem
>>>>> totally off. This leaves me clueless as to where to put this
>>>>> ieee80211_header.
>>>>> I've tried putting it right on skb->head (wrong I know, but I was
>>>>> getting desperate), on skb->mac_header (also wrong, no idea why
>>>>> though), I went back from skb->tail with len and even added ETH_HLEN
>>>>> to that as well because you can see that before my hook gets
>>>>> activated: skb_pull_inline(skb, ETH_HLEN);
>>>>> In the end I'm left with a header that is forced onto data but with a
>>>>> wrong origin pointer thus basically leaving me with all wrong data in
>>>>> the header.
>>>>>
>>>>> Kind regards,
>>>>> Mathieu Devos
>>>>>
>>>>> On Wed, Jul 31, 2013 at 12:08 PM, Arend van Spriel <arend@broadcom.com>
>>>>> wrote:
>>>>>>
>>>>>>
>>>>>> On 07/31/2013 11:39 AM, Mathieu Devos wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I hope this is the right place to ask for a little bit of help as I'm
>>>>>>> currently beyond stuck on a challenge I'm trying to accomplish. I'm
>>>>>>> trying to write a "simple" LKM that properly uses a ieee80211 header
>>>>>>> to print information about the mac addresses (addr1->addr4) and later
>>>>>>> down the road try to send my own data.
>>>>>>>
>>>>>>> I only need to get L2 working, no need for TCP/IP, just a proper
>>>>>>> ieee80211 based on input from skb would be huge for me.
>>>>>>>
>>>>>>> So my issue: when placing the ieee80211 on my mac_header after I hook
>>>>>>> my skb from my wireless device (wlan0 on android - I9100)
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Not sure what you goal is, but what wireless device is that? You may
>>>>>> just
>>>>>> get 802.3 packets from the device.
>>>>>>
>>>>>> Gr. AvS
>>>>>>
>>>>>>
>>>>>>> I get a huge
>>>>>>> amount of zero's and random(?) numbers when trying to print the
>>>>>>> addresses. This leads me to the first conclusion that mac_header is
>>>>>>> placed wrong when using 80211. After that I saw a lot of people just
>>>>>>> using the skb->data pointer. Now this gives even weirder issues for me
>>>>>>> and actually totally crashes my kernel.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
>
next prev parent reply other threads:[~2013-07-31 15:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-31 9:39 Skb and ieee80211 headers Mathieu Devos
2013-07-31 10:08 ` Arend van Spriel
2013-07-31 10:28 ` Mathieu Devos
2013-07-31 11:05 ` Arend van Spriel
2013-07-31 12:39 ` Mathieu Devos
2013-07-31 12:55 ` Arend van Spriel
2013-07-31 13:45 ` Mathieu Devos
2013-07-31 15:04 ` Arend van Spriel [this message]
2013-07-31 15:11 ` Mathieu Devos
2013-08-02 7:49 ` Mathieu Devos
2013-08-07 10:27 ` Arend van Spriel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51F9276F.1040908@broadcom.com \
--to=arend@broadcom.com \
--cc=linux-wireless@vger.kernel.org \
--cc=mathieu.devos@ugent.be \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).