From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lee Hambley Subject: Fwd: ieee80211_radiotap_iterator_next return values Date: Fri, 10 May 2013 14:55:54 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b414c2efd3fd504dc5cafdf Return-path: In-Reply-To: Sender: radiotap-owner-sUITvd46vNxg9hUCZPvPmw@public.gmane.org To: radiotap-S783fYmB3Ccdnm+yROfE0A@public.gmane.org List-Id: radiotap@radiotap.org --047d7b414c2efd3fd504dc5cafdf Content-Type: text/plain; charset=UTF-8 Hi Guys, I'm new on the list, playing around trying to extract the radiotap headers from IEEE802.11 traffic, specifically relating to signal strength/etc. I've got some code that is using the functions ieee80211_radiotap_iterator_init() and ieee80211_radiotap_iterator_next() from radiotap-parser.c, I'm not sure what I'm doing incorrectly, perhaps someone can educate me? I'm using the sample code from http://www.cs.fsu.edu/~baker/devices/lxr/http/source/linux/Documentation/networking/radiotap-headers.txt?v=2.6.25more or less without modification, it fits very well to what I was trying to achieve: /* where packet is `const u_char *packet' */ struct ieee80211_radiotap_iterator rti; struct ieee80211_radiotap_header *rth = ( struct ieee80211_radiotap_header * ) packet; int ret = ieee80211_radiotap_iterator_init(&rti, rth, rth->it_len); while(!ret) { printf("Itteration: %d\n", count++); ret = ieee80211_radiotap_iterator_next(&rti); if(ret) { continue; } switch(rti.this_arg_index) { default: printf("Constant: %d\n", *rti.this_arg); break; } } There's limited scope for having screwed something up in that code, I think, I'm confused by the `1' being returned from ` ieee80211_radiotap_iterator_init' which according to the implenentation doesn't seem like an error condition in the implementation http://lxr.free-electrons.com/source/net/wireless/radiotap.c#L95 Thanks for anything anyone on the list can suggest, I'm out of my element working at such a low level in C, but needs must! - Lee Hambley --047d7b414c2efd3fd504dc5cafdf Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Guys,

I'm new on the list, playing around trying to extra= ct the radiotap headers from IEEE802.11 traffic,=C2=A0specifically=C2=A0rel= ating to signal strength/etc.

I've got some co= de that is using the functions=C2=A0ieee80211_radiotap_= iterator_init()=C2=A0and=C2=A0ieee80211_radiotap= _iterator_next()=C2=A0from=C2=A0radiotap-parser.c,=C2=A0

I'm not sure what I'm doing incorrectly, perhap= s someone can educate me? I'm using the sample code from=C2=A0http://www.= cs.fsu.edu/~baker/devices/lxr/http/source/linux/Documentation/networking/ra= diotap-headers.txt?v=3D2.6.25 more or less without modification, it fit= s very well to what I was trying to achieve:

=C2=A0/* where packet = is `const u_char *packet' */

struct ieee80211_radiotap_iterator = rti;
struct ieee80211_radiotap_header *rth =3D ( struct ieee80211_radiot= ap_header * ) packet;
int ret =3D ieee80211_radiotap_iterator_init(&rti, rth, rth->it_len)= ;
while(!ret) {
=C2=A0 printf("Itteration: %d\n", count++);=
=C2=A0 ret =3D ieee80211_radiotap_iterator_next(&rti);
=C2=A0 if= (ret) {
=C2=A0 =C2=A0 continue;
=C2=A0 }
=C2=A0 switch(rti.this_arg_index) {
=C2=A0 default:
=C2=A0 =C2=A0 printf("Constant: %d\n&q= uot;, *rti.this_arg);
=C2=A0 =C2=A0 break;
=C2=A0 }
}

=
There's limited = scope for having screwed something up in that code, I think, I'm confus= ed by the `1' being returned from `ieee80211_radiotap_ite= rator_init= 9; which according to the implenentation doesn't seem like an error con= dition in the implementation=C2=A0http://lxr.free-electrons.com/source/net/wire= less/radiotap.c#L95

Thanks for anything anyone on the l= ist can suggest, I'm out of my element working at such a low level in C= , but needs must!

- Lee Hambley

--047d7b414c2efd3fd504dc5cafdf-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lee Hambley Subject: Fwd: ieee80211_radiotap_iterator_next return values Date: Fri, 10 May 2013 15:16:31 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c2ca38be011204dc5cf957 Return-path: In-Reply-To: Sender: radiotap-owner-sUITvd46vNxg9hUCZPvPmw@public.gmane.org To: radiotap-S783fYmB3Ccdnm+yROfE0A@public.gmane.org List-Id: radiotap@radiotap.org --001a11c2ca38be011204dc5cf957 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I've cross-posted to StackOverflow because I wasn't sure whether my message had made it to the list or not thus far. The SO post includes more details, better explanation and more code in my example. My apologies for the spam. =E2=80=A2 http://stackoverflow.com/questions/16483010/libpcap-radiotap-header-extract= ion Lee Hambley -- http://lee.hambley.name/ +49 (0) 170 298 5667 ---------- Forwarded message ---------- From: Lee Hambley Date: 10 May 2013 14:55 Subject: Fwd: ieee80211_radiotap_iterator_next return values To: radiotap-S783fYmB3Ccdnm+yROfE0A@public.gmane.org Hi Guys, I'm new on the list, playing around trying to extract the radiotap headers from IEEE802.11 traffic, specifically relating to signal strength/etc. I've got some code that is using the functions ieee80211_radiotap_iterator_init() and ieee80211_radiotap_iterator_next() from radiotap-parser.c, I'm not sure what I'm doing incorrectly, perhaps someone can educate me? I'm using the sample code from http://www.cs.fsu.edu/~baker/devices/lxr/http/source/linux/Documentation/ne= tworking/radiotap-headers.txt?v=3D2.6.25more or less without modification, it fits very well to what I was trying to achieve: /* where packet is `const u_char *packet' */ struct ieee80211_radiotap_iterator rti; struct ieee80211_radiotap_header *rth =3D ( struct ieee80211_radiotap_heade= r * ) packet; int ret =3D ieee80211_radiotap_iterator_init(&rti, rth, rth->it_len); while(!ret) { printf("Itteration: %d\n", count++); ret =3D ieee80211_radiotap_iterator_next(&rti); if(ret) { continue; } switch(rti.this_arg_index) { default: printf("Constant: %d\n", *rti.this_arg); break; } } There's limited scope for having screwed something up in that code, I think, I'm confused by the `1' being returned from ` ieee80211_radiotap_iterator_init' which according to the implenentation doesn't seem like an error condition in the implementation http://lxr.free-electrons.com/source/net/wireless/radiotap.c#L95 Thanks for anything anyone on the list can suggest, I'm out of my element working at such a low level in C, but needs must! - Lee Hambley --001a11c2ca38be011204dc5cf957 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I've cross-posted to StackOverflow because I wasn'= t sure whether my message had made it to the list or not thus far. The SO p= ost includes more details, better explanation and more code in my example. = My apologies for the spam.


Lee Hambley
--
+49 (0) 170 298 5667
<= /div>

---------- Forwarded message ----------<= br>From: Lee Hambley &l= t;lee.hambley-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Date: 10 May 2013 14:55
Subject: Fwd: ieee80211_radiotap_iterator_next r= eturn values
To: radiotap@netbsd.= org


Hi Guys,

I'm new on the list, playing around trying to extra= ct the radiotap headers from IEEE802.11 traffic,=C2=A0specifically=C2=A0rel= ating to signal strength/etc.

I've got some co= de that is using the functions=C2=A0ieee80211_radiotap_= iterator_init()=C2=A0and=C2=A0ieee80211_radiotap= _iterator_next()=C2=A0from=C2=A0radiotap-parser.c,=C2=A0

I'm not sure what I'm doing incorrectly, perhap= s someone can educate me? I'm using the sample code from=C2=A0http://www.= cs.fsu.edu/~baker/devices/lxr/http/source/linux/Documentation/networking/ra= diotap-headers.txt?v=3D2.6.25 more or less without modification, it fit= s very well to what I was trying to achieve:

=C2=A0/* where packet = is `const u_char *packet' */

struct ieee80211_radiotap_iterator = rti;
struct ieee80211_radiotap_header *rth =3D ( struct ieee80211_radiot= ap_header * ) packet;
int ret =3D ieee80211_radiotap_iterator_init(&rti, rth, rth->it_len)= ;
while(!ret) {
=C2=A0 printf("Itteration: %d\n", count++);=
=C2=A0 ret =3D ieee80211_radiotap_iterator_next(&rti);
=C2=A0 if= (ret) {
=C2=A0 =C2=A0 continue;
=C2=A0 }
=C2=A0 switch(rti.this_arg_index) {
=C2=A0 default:
=C2=A0 =C2=A0 printf("Constant: %d\n&q= uot;, *rti.this_arg);
=C2=A0 =C2=A0 break;
=C2=A0 }
}

=
There's limited = scope for having screwed something up in that code, I think, I'm confus= ed by the `1' being returned from `ieee80211_radiotap_ite= rator_init= 9; which according to the implenentation doesn't seem like an error con= dition in the implementation=C2=A0http://lxr.free-electrons.com/source/net/wire= less/radiotap.c#L95

Thanks for anything anyone on the l= ist can suggest, I'm out of my element working at such a low level in C= , but needs must!

- Lee Hambley


--001a11c2ca38be011204dc5cf957-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johannes Berg Subject: Re: Fwd: ieee80211_radiotap_iterator_next return values Date: Fri, 10 May 2013 15:32:09 +0200 Message-ID: <1368192729.8390.17.camel@jlt4.sipsolutions.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: radiotap-owner-sUITvd46vNxg9hUCZPvPmw@public.gmane.org To: Lee Hambley Cc: radiotap-S783fYmB3Ccdnm+yROfE0A@public.gmane.org List-Id: radiotap@radiotap.org On Fri, 2013-05-10 at 14:55 +0200, Lee Hambley wrote: > int ret = ieee80211_radiotap_iterator_init(&rti, rth, rth->it_len); > while(!ret) { > printf("Itteration: %d\n", count++); > ret = ieee80211_radiotap_iterator_next(&rti); > > There's limited scope for having screwed something up in that code, I > think, I'm confused by the `1' being returned from > `ieee80211_radiotap_iterator_init' which according to the > implenentation doesn't seem like an error condition in the > implementation http://lxr.free-electrons.com/source/net/wireless/radiotap.c#L95 I think you're confusing the userspace and Linux kernel implementation, though they're very similar. In any case, ieee80211_radiotap_iterator_next() cannot return 1, unless one of the error values is defined to -1 (it returns -EINVAL and a few others) johannes From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lee Hambley Subject: Re: Fwd: ieee80211_radiotap_iterator_next return values Date: Fri, 10 May 2013 16:40:23 +0200 Message-ID: References: <1368192729.8390.17.camel@jlt4.sipsolutions.net> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e0122a146acf6e704dc5e25b4 Return-path: In-Reply-To: <1368192729.8390.17.camel-8Nb76shvtaUJvtFkdXX2HixXY32XiHfO@public.gmane.org> Sender: radiotap-owner-sUITvd46vNxg9hUCZPvPmw@public.gmane.org To: radiotap-S783fYmB3Ccdnm+yROfE0A@public.gmane.org List-Id: radiotap@radiotap.org --089e0122a146acf6e704dc5e25b4 Content-Type: text/plain; charset=UTF-8 Hi Johannes, I hadn't even considered that, I'll have to go and have a look for the userspace implementation of those functions, I'd suppose that the ones I have pulled in are probably from the kernel if they are returning `1`. Are these functions included with any of the radiotap (tcpdump, libpcap in particular) codebases? Or something similar. Thanks, good to know I did manage to register myself for the list correctly! Lee Hambley -- http://lee.hambley.name/ +49 (0) 170 298 5667 On 10 May 2013 15:32, Johannes Berg wrote: > On Fri, 2013-05-10 at 14:55 +0200, Lee Hambley wrote: > > > int ret = ieee80211_radiotap_iterator_init(&rti, rth, rth->it_len); > > while(!ret) { > > printf("Itteration: %d\n", count++); > > ret = ieee80211_radiotap_iterator_next(&rti); > > > > > There's limited scope for having screwed something up in that code, I > > think, I'm confused by the `1' being returned from > > `ieee80211_radiotap_iterator_init' which according to the > > implenentation doesn't seem like an error condition in the > > implementation > http://lxr.free-electrons.com/source/net/wireless/radiotap.c#L95 > > I think you're confusing the userspace and Linux kernel implementation, > though they're very similar. In any case, > ieee80211_radiotap_iterator_next() cannot return 1, unless one of the > error values is defined to -1 (it returns -EINVAL and a few others) > > johannes > > > --089e0122a146acf6e704dc5e25b4 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Johannes,

I hadn't even consider= ed that, I'll have to go and have a look for the userspace implementati= on of those functions, I'd suppose that the ones I have pulled in are p= robably from the kernel if they are returning `1`.

Are these functions included with any of the radi= otap (tcpdump, libpcap in particular) codebases? Or something similar.

Thanks, good to know I did manage to regis= ter myself for the list correctly!

Lee Hambley
--<= /div>
+49 (0) 170 298 5667


On 10 May 2013 15:32, Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org> wrote:
On Fri, 2013-05-10 at 14:55 +0200, Lee Hambley wrote:

> int ret =3D ieee80211_radiotap_iterator_init(&rti, rth, rth->it= _len);
> while(!ret) {
> =C2=A0 printf("Itteration: %d\n", count++);
> =C2=A0 ret =3D ieee80211_radiotap_iterator_next(&rti);

>
> There's limited scope for having screwed s= omething up in that code, I
> think, I'm confused by the `1' being returned from
> `ieee80211_radiotap_iterator_init' which according to the
> implenentation doesn't seem like an error condition in the
> implementation http://lxr.free-electrons.com/sourc= e/net/wireless/radiotap.c#L95

I think you're confusing the userspace and Linux kernel implement= ation,
though they're very similar. In any case,
ieee80211_radiotap_iterator_next() cannot return 1, unless one of the
error values is defined to -1 (it returns -EINVAL and a few others)

johannes



--089e0122a146acf6e704dc5e25b4-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lee Hambley Subject: Re: Fwd: ieee80211_radiotap_iterator_next return values Date: Fri, 10 May 2013 17:22:48 +0200 Message-ID: References: <1368192729.8390.17.camel@jlt4.sipsolutions.net> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b414c2e528a2804dc5ebda4 Return-path: In-Reply-To: Sender: radiotap-owner-sUITvd46vNxg9hUCZPvPmw@public.gmane.org To: radiotap-S783fYmB3Ccdnm+yROfE0A@public.gmane.org List-Id: radiotap@radiotap.org --047d7b414c2e528a2804dc5ebda4 Content-Type: text/plain; charset=UTF-8 To clarify, I'm using (at present) the implementation from http://airscan.googlecode.com/svn-history/r2/trunk/radiotap-parser.c - not being an expert in such things it looks like the use of le32_to_cpu is an indication that this is designed to be used in userspace, but still - the iteration function is still returning `1'. Lee Hambley -- http://lee.hambley.name/+49 (0) 170 298 5667 On 10 May 2013 16:40, Lee Hambley wrote: > > Hi Johannes, > > I hadn't even considered that, I'll have to go and have a look for the userspace implementation of those functions, I'd suppose that the ones I have pulled in are probably from the kernel if they are returning `1`. > > Are these functions included with any of the radiotap (tcpdump, libpcap in particular) codebases? Or something similar. > > Thanks, good to know I did manage to register myself for the list correctly! > > Lee Hambley > -- > http://lee.hambley.name/ > +49 (0) 170 298 5667 > > > On 10 May 2013 15:32, Johannes Berg wrote: >> >> On Fri, 2013-05-10 at 14:55 +0200, Lee Hambley wrote: >> >> > int ret = ieee80211_radiotap_iterator_init(&rti, rth, rth->it_len); >> > while(!ret) { >> > printf("Itteration: %d\n", count++); >> > ret = ieee80211_radiotap_iterator_next(&rti); >> >> > >> > There's limited scope for having screwed something up in that code, I >> > think, I'm confused by the `1' being returned from >> > `ieee80211_radiotap_iterator_init' which according to the >> > implenentation doesn't seem like an error condition in the >> > implementation http://lxr.free-electrons.com/source/net/wireless/radiotap.c#L95 >> >> I think you're confusing the userspace and Linux kernel implementation, >> though they're very similar. In any case, >> ieee80211_radiotap_iterator_next() cannot return 1, unless one of the >> error values is defined to -1 (it returns -EINVAL and a few others) >> >> johannes >> >> > --047d7b414c2e528a2804dc5ebda4 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
To clarify, I'm using (at present) the implementation = from http://airscan.googlecode.com/svn-history/r2/trunk/radiotap-pars= er.c - not being an expert in such things it looks like the use of le32= _to_cpu is an indication that this is designed to be used in userspace, but= still - the iteration function is still returning `1'.

Lee Hambley
--
http://lee.ha= mbley.name/+49 (0) 170 298 5667


On 10 May 2013 16:40, Lee Ha= mbley <lee.hambley-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> Hi Johannes,
>
> I hadn't even considered that= , I'll have to go and have a look for the userspace implementation of t= hose functions, I'd suppose that the ones I have pulled in are probably= from the kernel if they are returning `1`.
>
> Are these functions included with any of the radiotap (tcpdump= , libpcap in particular) codebases? Or something similar.
>
> T= hanks, good to know I did manage to register myself for the list correctly!=
>
> Lee Hambley
> --
>
http://lee.hambley.name/
> +49 (0) 170 298 5667
>
= >
> On 10 May 2013 15:32, Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org> wrote:
>>
>> On Fri, 2013-05-10 at 14:55 +0200, Lee Hambley wrote:<= br>>>
>> > int ret =3D ieee80211_radiotap_iterator_init(&= amp;rti, rth, rth->it_len);
>> > while(!ret) {
>> &= gt; =C2=A0 printf("Itteration: %d\n", count++);
>> > =C2=A0 ret =3D ieee80211_radiotap_iterator_next(&rti);>>
>> >
>> > There's limited scope for h= aving screwed something up in that code, I
>> > think, I'm = confused by the `1' being returned from
>> > `ieee80211_radiotap_iterator_init' which according to the=
>> > implenentation doesn't seem like an error condition i= n the
>> > implementation http://lxr.free-electrons.com/sourc= e/net/wireless/radiotap.c#L95
>>
>> I think you're confusing the userspace and Linux k= ernel implementation,
>> though they're very similar. In any c= ase,
>> ieee80211_radiotap_iterator_next() cannot return 1, unless= one of the
>> error values is defined to -1 (it returns -EINVAL and a few others= )
>>
>> johannes
>>
>>
>
--047d7b414c2e528a2804dc5ebda4-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johannes Berg Subject: Re: Fwd: ieee80211_radiotap_iterator_next return values Date: Fri, 10 May 2013 18:44:07 +0200 Message-ID: <1368204247.8390.20.camel@jlt4.sipsolutions.net> References: <1368192729.8390.17.camel@jlt4.sipsolutions.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: radiotap-owner-sUITvd46vNxg9hUCZPvPmw@public.gmane.org To: Lee Hambley Cc: radiotap-S783fYmB3Ccdnm+yROfE0A@public.gmane.org List-Id: radiotap@radiotap.org On Fri, 2013-05-10 at 17:22 +0200, Lee Hambley wrote: > To clarify, I'm using (at present) the implementation from > http://airscan.googlecode.com/svn-history/r2/trunk/radiotap-parser.c - > not being an expert in such things it looks like the use of > le32_to_cpu is an indication that this is designed to be used in > userspace, but still - the iteration function is still returning `1'. That's a (slightly) different implementation that doesn't match the other implementations you've been looking at. If you read the comments in that file, it'll be obvious why it returns 1. Basically though your problem is that you're taking the radiotap parser from one place, and the example code from another, and the two differ in API used. johannes