What is the maximum filter length
There's no fixed maximum length; however:
- the filter is compiled into BPF pseudo-machine language and, on most platforms, handed to kernel-mode code, which probably imposes a maximum compiled-code size - if that's exceeded, the kernel-mode code will reject it, and libpcap/WinPcap/Npcap would have to do the filtering in user mode, with every received packet being copied up to user mode, which may cause more packet drops with high-volume traffic;
- the compiler's optimizer code path involves recursion, and a sufficiently complicated expression might cause a stack overflow.
can this be done through a file based method
tcpdump supports the -F
command-line option, causing it to read the filter expression from a file.
TShark doesn't support that, although, with a UN*X-style shell, you could do
tshark -f `cat filter-file`
to insert the filter into a command-line from a file.
For Wireshark, you'd have to copy from the file and past into Wireshark.
Is this a duplicate of your earlier question Extensive Filter Development?
If so, then we'll delete this question and you can amend your original question as required.
Yes, sorry, the first one appeared lost during account creation, I guess it posted anyway. I prefer this one over the other. Thank you!
I marked the first as deleted.