-
Notifications
You must be signed in to change notification settings - Fork 864
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
Multiple VLAN IDs and ranges with a single vlan option in capture filter #815
Comments
It would be possible, it requires code. |
It would probably be handled similarly to the way |
guyharris: such syntax consistent with portrange would be perfect (e.g. easier to remember from user perspective); perhaps any further similar requests for other options raised by others can also follow the same pattern. |
Really sorry for being annoying but is there a chance to see it implemented anytime soon? We're currently having to deal with gigabyte long packet captures for mere minutes of capturing... |
As a workaround you can use:
Of course with a whole list of vlans to capture this filter can be quite long, but at least, you get to have small capture files. Another option would be to filter out those vlans that carry the most traffic (if there are a couple of really chatty vlans). |
Thanks for your reply. Unfortunately it no longer works: "The kernel no longer passes vlan tag information as-is to libpcap, instead BPF needs to access ancillary data." Please find my thread @ Wireshark Ask preceding my libpcap enhancement request: |
In that case, I just tried to use negative offsets (thanks for the link, I learned something new):
Which seems to result in valid BPF code that is similar to code for the the "vlan 100" filter. I have not tried it myself (no vlan tagged interface available for testing at the moment), but I expect it to work. And yes, we met on ask.wireshark.org too, I showed you the "vlan.id in {x..y a..b}" syntax :-) |
Thank you: I'll then give these negative offsets a try and report on the outcome. Btw thanks for sharing the "vlan.id in {x..y a..b}" back then: the life with it got much better ) |
I recommend using There are a number of attributes accessible via the negative mechanism. I usually look in the kernel source/headers, /usr/include/linux/filter.h or net/core/filter.c . Note that on a Linux SLL or SLL2 socket (i.e., "-i any"), negative offsets will be corrupted until my pull request or something similar is implemented: #820 |
Good point, missed that in my quick test :-) |
@syn-bit : really sorry for not getting back with the results back then. Soon after someone found a way to filter those VLANs in traffic before sending it to my VM, making these filters no longer necessary. I've just come across my old threads about it by chance and tried your negative offsets. They seem to work perfectly well with at least 2 of my VLANs, so I'll be using them for now whenever I have to filter it myself again: thank you! Meanwhile it'd be nice to see something like "vlanrange 2001-2006 or 1506-1507 or 1552-1553 or 2025-2026" implemented one day as per @guyharris 's reply above. @fenner : could you please explain what ":?" I get when omitting ":2" as you advised? I thought ":2" means analyse 2 bytes starting at that offset, and as both of these seem to work equally well for my VLAN IDs >255 do I get it right that omitting ":2" makes it fall back to ":4" by default?
|
See also #158. |
I see the following structure of this problem space:
|
Hello,
I've been redirected here with my capture filter related inquiry at Wireshark Ask:
https://ask.wireshark.org/question/8487/tshark-capture-filter-using-vlan-id/
Would it be possible to extend vlan option syntax in a capture filter so that a single vlan option accepts >1 VLAN ID and ideally also VLAN ID ranges, e.g. something like "vlan 2001-2006,1506-1507, 1552-1553, 2025-2026"?
Many thanks in anticipation!
The text was updated successfully, but these errors were encountered: