tcpdump mailing list archives
Linux system headers 2.6.36 and pcap/bpf.h
From: Tim Sammut <tsammut () cisco com>
Date: Tue, 11 Jan 2011 23:47:31 -0800
Hello.
I have an odd problem and I am hoping you all can help.
It appears that starting in the Linux system headers around version
2.6.36 [1], /usr/include/linux/if_tun.h began including
/usr/include/linux/filter.h [2]. filter.h however, defines
BPF_MAJOR_VERSION which ends up excluding the entire contents of
pcap/bpf.h [3] via the leading #ifndef BPF_MAJOR_VERSION.
The end result is pcap.h must be included before linux/if_tun.h. This
causes this program it fail to compile:
#include <linux/if_tun.h>
#include <pcap.h>
int main(){
struct bpf_program p;
printf("size = %lu\n", sizeof(p));
}
producing this error message:
test.c: In function ‘main’:
test.c:5: error: storage size of ‘p’ isn’t known
But, allows this one to compile correctly:
#include <pcap.h>
#include <linux/if_tun.h>
int main(){
struct bpf_program p;
printf("size = %lu\n", sizeof(p));
}
Is this a known issue, or is there a more correct workaround?
thanks and hope all is well
tim
[1]
http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.36.y.git;a=commit;h=99405162598176e830d17ae6d4f3d9e070ad900c
[2]
http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.36.y.git;a=blob;f=include/linux/filter.h
[3]
https://github.com/mcr/libpcap/blob/028204e0f99f0bad5dfd01add364ebd4f4befabb/pcap/bpf.h
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.
Current thread:
- Linux system headers 2.6.36 and pcap/bpf.h Tim Sammut (Jan 11)
- Re: Linux system headers 2.6.36 and pcap/bpf.h Guy Harris (Jan 12)
- Re: Linux system headers 2.6.36 and pcap/bpf.h Guy Harris (Feb 01)
- Re: Linux system headers 2.6.36 and pcap/bpf.h Guy Harris (Jan 12)
