Commit ac8ed058 authored by garciay's avatar garciay

Add capability to capture without PCAP filter

parent e61c9f07
......@@ -101,18 +101,20 @@ public class PcapMultiplexer implements Runnable {
}
captureThread = new Thread(this);
captureThread.start();
filter = String.format("ether proto 0x%04x", frameType);
System.out.println("New filter: " + filter);
if (frameType != 0) {
filter = String.format("ether proto 0x%04x", frameType);
System.out.println("New filter: " + filter);
// Apply filter
PcapBpfProgram bpfFilter = new PcapBpfProgram();
int optimize = 0; // 1 means true, 0 means false
int netmask = 0;
int r = pcap.compile(bpfFilter, filter, optimize, netmask);
if (r != Pcap.OK) {
System.out.println("Filter error: " + pcap.getErr());
}
pcap.setFilter(bpfFilter);
// Apply filter
PcapBpfProgram bpfFilter = new PcapBpfProgram();
int optimize = 0; // 1 means true, 0 means false
int netmask = 0;
int r = pcap.compile(bpfFilter, filter, optimize, netmask);
if (r != Pcap.OK) {
System.out.println("Filter error: " + pcap.getErr());
}
pcap.setFilter(bpfFilter);
} // else, no filter
dumper = pcap.dumpOpen(client.getFileName());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment