New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
problem with 'vlan' expressions#113
Comments
Submitted by guy_harris This behavior is documented in the tcpdump man page in tcpdump 3.9.x (and in the pcap-filter man page in libpcap 1.x):
(Filter expressions are processed inside tcpdump by handing them to libpcap's pcap_compile() routine; tcpdump doesn't know anything about filtering, it leaves that to libpcap.) And there is another filter operation that behaves this way - "mpls". The problem is that filter expressions don't handle VLAN headers without an explicit "vlan" keyword - just "icmp", for example, won't find ICMP packets inside arbitrary numbers of VLAN headers. Given that the BPF "machine language" doesn't support looping (so you can't shove code into the kernel that can loop for an arbitrary amount of time), the general VLAN problem can't be solved with BPF as it exists. At some point it might be nice to fix that, but at that point people would probably then ask to have filters also look inside GRE and PPPoE and... packets, and filtering starts getting even more complicated. So, for now, the "vlan" expression will continue to behave this way. |
Also reviewed on the mailing list. |
For posterity, there is now a FAQ entry about this. |
Converted from SourceForge issue 2693245, submitted by linkj
When using the 'vlan' filter expressions I found the order in which the 'vlan' filter is placed matters. That is, 'vlan and icmp' will yield different results from 'icmp and vlan'. I have never seen this problem with any other combination of BPF filter expressions for tcpdump, only with the 'vlan' expression in combination with other expressions. See below for an example.
I've seen this problem tcpdump v4.0.0 and earlier versions. I am not sure if this is a libpcap issue, keyboard to floor problem or something to do with how filter expressions are processed inside tcpdump.
The text was updated successfully, but these errors were encountered: