mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-27 03:53:53 +08:00
We have to set the filter on every new file.
Even if we haven't recompiled the filter, because the new file has the same DLT as the old file, we still need to apply it to the new file.
This commit is contained in:
parent
321383790f
commit
c66320c670
19
tcpdump.c
19
tcpdump.c
@ -1840,19 +1840,24 @@ main(int argc, char **argv)
|
||||
* We're printing the decoded packets;
|
||||
* switch to the new DLT.
|
||||
*
|
||||
* To do that, we need to recompile
|
||||
* the filter, change the printer,
|
||||
* and change the DLT name.
|
||||
* To do that, we need to change
|
||||
* the printer, change the DLT name,
|
||||
* and recompile the filter with
|
||||
* the new DLT.
|
||||
*/
|
||||
dlt = new_dlt;
|
||||
if (pcap_compile(pd, &fcode, cmdbuf, Oflag, netmask) < 0)
|
||||
error("%s", pcap_geterr(pd));
|
||||
if (pcap_setfilter(pd, &fcode) < 0)
|
||||
error("%s", pcap_geterr(pd));
|
||||
ndo->ndo_if_printer = get_if_printer(ndo, dlt);
|
||||
dlt_name = pcap_datalink_val_to_name(dlt);
|
||||
if (pcap_compile(pd, &fcode, cmdbuf, Oflag, netmask) < 0)
|
||||
error("%s", pcap_geterr(pd));
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the filter on the new file.
|
||||
*/
|
||||
if (pcap_setfilter(pd, &fcode) < 0)
|
||||
error("%s", pcap_geterr(pd));
|
||||
|
||||
/*
|
||||
* Report the new file.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user