Networking Forums

Networking Forums > Computer Networking > Linux Networking > BPF packet filter and pcap_compile()

Reply
Thread Tools Display Modes

BPF packet filter and pcap_compile()

 
 
lulepenguin
Guest
Posts: n/a

 
      08-25-2005, 07:49 AM
Short question: I am modifying some code that utilizes the BPF. The
filter is hard-coded in "packet filter assembler", but I would like to
use libpcap:s pcap_compile() function to create a filter from a command
string, e.g. "tcp and port 67 and ..." as in W.R. Stevens' UNP. Now my
question: The existing code does not use libpcap to open sniffing
devices etc, and I would like to keep it that way. However,
pcap_compile() needs a pcap_t device handle. Can I use libpcap
functions to open a sniffing device to create the pcap_t handle,
compile the filter with pcap_compile(), then use this filter with a the
/dev/bpf type device opened by the existing code? (the existing code
uses the same filter structs as libpcap)
(obviously, if the existing code opens a sniffing device that monitors
eth0, I would need to make the pcap_t handle also correspond to eth0)

Linux-specific solutions are OK at this point, but something portable
to Solaris or BSD is even better.

Best regards,

/Erik Alapää

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
pcap_compile issue Shashank Linux Networking 0 12-30-2007 01:17 AM
Packet filter statistics question chukie_egg Linux Networking 0 04-13-2005 10:00 AM
Interface error and packet filter error for Remote Access Tony Birnseth Windows Networking 0 09-19-2004 04:28 PM
vpn packet filter in win2k3 cboesch Windows Networking 1 07-13-2004 09:31 AM
Zyxel 650H DSL modem packet filter setting artw Broadband 3 08-04-2003 08:26 AM



1 2 3 4 5 6 7 8 9 10 11