Skip to content

Commit

Permalink
Use BPF filter when parsing PCAP file
Browse files Browse the repository at this point in the history
  • Loading branch information
chazlever committed Jul 11, 2020
1 parent f384c25 commit ec1cd18
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions parser/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ func ParseFile(fname string) {
}
defer handle.Close()

// Setup BPF filter on handle
bpfFilter := "udp port 53"
if DoParseTcp {
bpfFilter = "port 53"
}
err = handle.SetBPFFilter(bpfFilter)
if err != nil {
log.Warnf("Could not set BPF filter: %v\n", err)
}

ParseDns(handle)
}

Expand Down

0 comments on commit ec1cd18

Please sign in to comment.