* Fwd: ieee80211_radiotap_iterator_next return values [not found] ` <CAN_+VLVe6D=HLeKynF1OLnv=X4Pn34xfDUsR1rvVCCR5BB5xdg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2013-05-10 12:55 ` Lee Hambley [not found] ` <CAN_+VLVY9OY5OdAHs6mdzKLXcubAbHPXprsQis58+_ze939hQw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Lee Hambley @ 2013-05-10 12:55 UTC (permalink / raw) To: radiotap-S783fYmB3Ccdnm+yROfE0A [-- Attachment #1: Type: text/plain, Size: 1545 bytes --] 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 [-- Attachment #2: Type: text/html, Size: 3364 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <CAN_+VLVY9OY5OdAHs6mdzKLXcubAbHPXprsQis58+_ze939hQw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Fwd: ieee80211_radiotap_iterator_next return values [not found] ` <CAN_+VLVY9OY5OdAHs6mdzKLXcubAbHPXprsQis58+_ze939hQw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2013-05-10 13:16 ` Lee Hambley 2013-05-10 13:32 ` Johannes Berg 1 sibling, 0 replies; 6+ messages in thread From: Lee Hambley @ 2013-05-10 13:16 UTC (permalink / raw) To: radiotap-S783fYmB3Ccdnm+yROfE0A [-- Attachment #1: Type: text/plain, Size: 2237 bytes --] 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. • http://stackoverflow.com/questions/16483010/libpcap-radiotap-header-extraction Lee Hambley -- http://lee.hambley.name/ +49 (0) 170 298 5667 ---------- Forwarded message ---------- From: Lee Hambley <lee.hambley-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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/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 [-- Attachment #2: Type: text/html, Size: 4553 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Fwd: ieee80211_radiotap_iterator_next return values [not found] ` <CAN_+VLVY9OY5OdAHs6mdzKLXcubAbHPXprsQis58+_ze939hQw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2013-05-10 13:16 ` Lee Hambley @ 2013-05-10 13:32 ` Johannes Berg [not found] ` <1368192729.8390.17.camel-8Nb76shvtaUJvtFkdXX2HixXY32XiHfO@public.gmane.org> 1 sibling, 1 reply; 6+ messages in thread From: Johannes Berg @ 2013-05-10 13:32 UTC (permalink / raw) To: Lee Hambley; +Cc: radiotap-S783fYmB3Ccdnm+yROfE0A 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <1368192729.8390.17.camel-8Nb76shvtaUJvtFkdXX2HixXY32XiHfO@public.gmane.org>]
* Re: Fwd: ieee80211_radiotap_iterator_next return values [not found] ` <1368192729.8390.17.camel-8Nb76shvtaUJvtFkdXX2HixXY32XiHfO@public.gmane.org> @ 2013-05-10 14:40 ` Lee Hambley [not found] ` <CAN_+VLX8_suEo_=C2sXoz00aRNtbAtpmKjfVUZVHc1RQbe29ew-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Lee Hambley @ 2013-05-10 14:40 UTC (permalink / raw) To: radiotap-S783fYmB3Ccdnm+yROfE0A [-- Attachment #1: Type: text/plain, Size: 1457 bytes --] 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 <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org> 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 > > > [-- Attachment #2: Type: text/html, Size: 2348 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <CAN_+VLX8_suEo_=C2sXoz00aRNtbAtpmKjfVUZVHc1RQbe29ew-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: Fwd: ieee80211_radiotap_iterator_next return values [not found] ` <CAN_+VLX8_suEo_=C2sXoz00aRNtbAtpmKjfVUZVHc1RQbe29ew-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2013-05-10 15:22 ` Lee Hambley [not found] ` <CAN_+VLXwax5Ok_BJ-d2ss8M90yyMjQ8smZo4uSpwGdnSQWSH-A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Lee Hambley @ 2013-05-10 15:22 UTC (permalink / raw) To: radiotap-S783fYmB3Ccdnm+yROfE0A [-- Attachment #1: Type: text/plain, Size: 1988 bytes --] 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 <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 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 <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org> 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 >> >> > [-- Attachment #2: Type: text/html, Size: 2858 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <CAN_+VLXwax5Ok_BJ-d2ss8M90yyMjQ8smZo4uSpwGdnSQWSH-A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: Fwd: ieee80211_radiotap_iterator_next return values [not found] ` <CAN_+VLXwax5Ok_BJ-d2ss8M90yyMjQ8smZo4uSpwGdnSQWSH-A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2013-05-10 16:44 ` Johannes Berg 0 siblings, 0 replies; 6+ messages in thread From: Johannes Berg @ 2013-05-10 16:44 UTC (permalink / raw) To: Lee Hambley; +Cc: radiotap-S783fYmB3Ccdnm+yROfE0A 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-05-10 16:44 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <CAN_+VLVe6D=HLeKynF1OLnv=X4Pn34xfDUsR1rvVCCR5BB5xdg@mail.gmail.com> [not found] ` <CAN_+VLVe6D=HLeKynF1OLnv=X4Pn34xfDUsR1rvVCCR5BB5xdg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2013-05-10 12:55 ` Fwd: ieee80211_radiotap_iterator_next return values Lee Hambley [not found] ` <CAN_+VLVY9OY5OdAHs6mdzKLXcubAbHPXprsQis58+_ze939hQw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2013-05-10 13:16 ` Lee Hambley 2013-05-10 13:32 ` Johannes Berg [not found] ` <1368192729.8390.17.camel-8Nb76shvtaUJvtFkdXX2HixXY32XiHfO@public.gmane.org> 2013-05-10 14:40 ` Lee Hambley [not found] ` <CAN_+VLX8_suEo_=C2sXoz00aRNtbAtpmKjfVUZVHc1RQbe29ew-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2013-05-10 15:22 ` Lee Hambley [not found] ` <CAN_+VLXwax5Ok_BJ-d2ss8M90yyMjQ8smZo4uSpwGdnSQWSH-A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2013-05-10 16:44 ` Johannes Berg
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).