我有一些代码使用了来自ieee80211_radiotap_iterator_init()和ieee80211_radiotap_iterator_next()的radiotap-parser.c函数,
我不知道我做错了什么,也许有人能教育我?我或多或少地使用了来自文献资料的示例代码,而无需修改,它非常适合我试图实现的目标:
/* where packet is `const u_char *packet' */
struct ieee80211_radiotap_iterator rti;
struct ieee80211_radiotap_header *rth = ( struct ieee80211_radiotap_header * ) packet;
/* 802.11 frame starts here */
struct wi_frame *fr= ( struct wi_frame * ) ( packet + rth->it_len );
/* Set up the iteration */
int ret = ieee80211_radiotap_iterator_init(&rti, rth, rth->it_len);
/* Loop until we've consumed all the fields */
while(!ret) {
printf("Itteration: %d\n", count++);
ret = ieee80211_radiotap_iterator_next(&rti);
if(ret) {
/*
* The problem is here, I'm dropping into this clause with
* a value of `1` consistently, that doesn't match my platform's
* definition of EINVAL or ENOENT.
*/
continue;
}
switch(rti.this_arg_index) {
default:
printf("Constant: %d\n", *rti.this_arg);
break;
}
}在代码中出错的空间有限,我想,我对从ieee80211_radiotap_iterator_next()返回的ieee80211_radiotap_iterator_next()感到困惑,根据实现,这在实施中似乎并不是一个错误条件。
我正在筛选"(type mgt) and (not type mgt subtype beacon)"类型的数据包,甚至不确定当数据链接设置为DLT_IEEE802_11_RADIO时,libpcap是否会包含这些属性
发布于 2013-05-10 18:45:05
第一:
我正在筛选“( mgt类型)和(不是mgt子类型信标)”类型的数据包,我甚至不确定当数据链接设置为DLT_IEEE802_11_RADIO时libpcap是否会包含这些属性?
它会的。为DLT_IEEE802_11_RADIO生成的过滤器代码获取无线电头的长度并跳过无线电头,因此它将跳过无线电头并检查它后面的802.11头。
第二:
实施
您链接到两个不同的ieee80211_radiotap_iterator_next() - 在无线电服务中心的那个实现,其中ieee80211_radiotap_iterator_next()在成功时返回“下一个当前arg索引”,而在Linux内核中的中,ieee80211_radiotap_iterator_next()在成功时返回0。如果您正在使用的无线电迭代器代码是在Radiapt-parser.c中使用的代码,则不要注意Linux内核中的代码,因为它的行为方式与您使用的代码不同。
https://stackoverflow.com/questions/16483010
复制相似问题