我有一些使用函数的代码ieee80211_radiotap_iterator_init()
和ieee80211_radiotap_iterator_next()
from 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;
}
}
我认为,在该代码中搞砸某些东西的范围是有限的,我对1
返回的结果感到困惑ieee80211_radiotap_iterator_next()
,根据实施,这似乎不是实现中的错误条件。
我正在过滤类型的数据包"(type mgt) and (not type mgt subtype beacon)"
,我什至不确定当数据链接设置为时 libpcap 是否会包含这些属性DLT_IEEE802_11_RADIO
?