3 * Make sure you compile it against the same libpcap version used in OpenWrt
12 # include <linux/types.h>
13 # include <linux/ppp_defs.h>
14 # include <pcap-bpf.h>
18 # include <net/ppp_defs.h>
22 # include <net/ppp_defs.h>
23 # define u_int32_t unsigned int
28 int main (int argc
, char ** argv
)
30 pcap_t
*pc
; /* Fake struct pcap so we can compile expr */
31 struct bpf_program filter
; /* Filter program for link-active pkts */
37 if (!strcmp (argv
[1], "-d"))
39 dflag
= atoi (argv
[2]);
46 printf ("usage; %s [ -d <debug_level> ] expression\n", argv
[0]);
50 pc
= pcap_open_dead(DLT_PPP_PPPD
, PPP_HDRLEN
);
51 if (pcap_compile(pc
, &filter
, argv
[1], 1, netmask
) == 0)
53 printf ("#\n# Expression: %s\n#\n", argv
[1]);
54 bpf_dump (&filter
, dflag
);
59 printf("error in active-filter expression: %s\n", pcap_geterr(pc
));