2013-05-10 4 views
0
나는 기능 ieee80211_radiotap_iterator_init()radiotap-parser.c에서 ieee80211_radiotap_iterator_next()를 사용하는 몇 가지 코드를 가지고

,libpcap의 Radiotap 헤더 추출

, 아마도 누군가가 나 교육을 할 수 있습니까? 제한 범위는 그 코드에 나사 무언가를 가지고위한있다

/* 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; 
    } 
} 

, 내가, 내가 생각 : 내가 수정없이 더 많거나 적은 the documentation에서 샘플 코드를 사용하고, 내가 달성하기 위해 노력하고 있었는지에 아주 잘 맞는 1ieee80211_radiotap_iterator_next()에서 반환됨에 혼란스러워서, implenentation에 따라 the implementation의 오류 조건처럼 보이지 않습니다.

"(type mgt) and (not type mgt subtype beacon)" 유형의 패킷을 필터링하고 있으며 데이터 링크가 DLT_IEEE802_11_RADIO으로 설정된 경우 libpcap에 이러한 속성이 포함되어 있는지 확실하지 않습니다.

답변

1

첫째 : libpcap의 이러한 특성을 포함하는 경우

I 유형의 패킷에 대한 필터링을하고 있습니다 "(형 MGT) 및 (안 입력 MGT 하위 유형 비콘)", 그리고 난 확실하지 않다 때 데이터 링크가 DLT_IEEE802_11_RADIO로 설정 되었습니까?

것입니다. DLT_IEEE802_11_RADIO에 대해 생성 된 필터 코드는 라디오 태그 헤더 길이를 가져 와서 라디오 태그 헤더를 건너 뜁니다. 따라서 라디오 태그 헤더를 건너 뛰고 그 뒤에 나오는 802.11 헤더를 확인합니다. 둘째

:

당신은 ieee80211_radiotap_iterator_next()다른 구현에 연결

구현 - the one at radiotap-parser.c, 어떤에서 ieee80211_radiotap_iterator_next() 반환 성공에 "다음 현재 인수 지수"및 the one from the Linux kernel, 여기서 ieee80211_radiotap_iterator_next()은 성공시 0을 반환합니다. 사용하고있는 radiotap 반복자 코드가 radiotap-parser.c에있는 코드라면 Linux 커널에서 무엇이든지주의를 기울이십시오. 사용하는 방식대로 작동하지 않기 때문입니다.

+0

감사합니다. 나는'ieee80211_radiotap_iterator_next()'의 사용자 영역 구현 결과를 사용하는 방법을 모르겠습니다. 그러나 나는 파기를 계속할 것이다. 동일한 두 함수의 두 가지 병렬 구현이 있다고 생각조차하지 못했습니다! –

관련 문제