We have a Linux box connected to a mirror port on a Juniper router. If I use tcpdump or tethereal to view packets live, I cannot filter by VLAN, but I can by host, e.g. It is particularly annoying that we cannot filter live by VLAN, e.g. We have libpcap-1.4.0 on CentOS 6 with a Mellanox driver v2.0 and a MT26448 card, connected to a Juniper EX9008 router. I want to be able to filter live by VLAN number. Is this something I can do with the right syntax, or is it an issue with the driver or OS or hardware ? asked 17 Oct '14, 16:15 adaviel |
2 Answers:
Linux does annoying things to VLAN tags in packets received on PF_PACKET sockets (libpcap uses PF_PACKET sockets on Linux), and libpcap doesn't yet compensate for that in the code that compiles filters. It does attempt to undo the things Linux does to the tags, so you see the packets complete with VLAN tags, so filters on a file containing those reconstructed packets works. answered 18 Oct '14, 01:02 Guy Harris ♦♦ Do you have any details ? Is it possible to patch libpcap or the network driver so that it will work ? (20 Oct '14, 17:26) adaviel http://lists.openwall.net/netdev/2008/07/08/31 talks about some of the problems. There was a blog entry on it as well, can't find that anymore. (21 Oct '14, 05:45) Jaap ♦ That's talking about kernel patches added in 2008. I believe that the one to linux/if_vlan.h is included in 2.6.32. I don't understand whether the patch is supposed to fix my problem, or whether it causes my problem. (22 Oct '14, 17:30) adaviel Take note of this part: "There are mainly two remaining problems with this approach:" which suggests to me that there are residual problems even after these patches applied. (23 Oct '14, 02:01) Jaap ♦ |
This may be fixed in libpcap 1.7.x See issue 390 answered 04 Nov '14, 14:02 adaviel |
could you please post the output of the following commands on your system?
please add the expected VLAN and traffic (IPs, protocol, ports, etc.)
HINT: the last command could produce a lot of output, depending on the traffic!
The web form won't let me add that much text. See http://andrew.triumf.ca/tcpdump_vlan.txt
I tried building the latest tarballs from tcpdump.org but they have the same issue.
can you please add the output of the following command:
this is without writing a capture file to disk.
OK, I've updated the link. How exactly is that different ? Is tcpdump -w x.cap different from tcpdump -w - > x.cap ? Reading from a file or stdin, they seem identical