Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 08-17-2005, 08:35 PM   #1
LQ Newbie
Registered: May 2005
Posts: 9

Rep: Reputation: 0
Question on PCAP filters


I am new to pcap programming and looking at its filters capabilities. I am
not able to find documentation on Filter Syntax, its limitations etc. Please
provide me with any links for this.

Can I add a filter to examine any part of packet? For example, on a TCP/IP/Ethernet packet, can I add a filter to match the 8 bytes starting from byte num 6 of Ethernet header?

What I need is the ability to create filters based on:

1) Starting offset from start of Ethernet packet
2) Length of the match (ie., compare 4 or 6 or 8 or any number of bytes)
3) Specify the value against which to compare

I would appreaciate any responses.

Old 08-17-2005, 08:59 PM   #2
Registered: Jun 2005
Posts: 542

Rep: Reputation: 34
Mmmm the bpf filter has something like array substrings but don't expect it to handle all possible situations, because it was designed to be run natively on networking BSD-derived kernels, so their purpose was speed between user-space and kernel

For this reason you could install a pcap handler and perform some of this "filtering" yourself. Anyway, a description of these expressions are in tcpdump(1). See pcap(3) too


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
PCAP on LOOPBACK Device johnnyde Programming 4 03-05-2009 05:05 AM
Pcap Files OriDagan Linux - Networking 0 07-15-2005 05:20 AM
pcap library jagman Programming 1 04-27-2005 08:35 AM
mac address with pcap SeanatIL Programming 2 07-19-2004 11:57 AM
Questions on pcap.h Traveler_Q Programming 2 02-25-2004 04:03 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:43 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration