mirror of
https://github.com/zeek/zeek.git
synced 2025-10-15 13:08:20 +00:00
Merge branch 'topic/rework-packets' of https://github.com/jsbarber/bro
* 'topic/rework-packets' of https://github.com/jsbarber/bro: One more tinker to Packet -- ensure no uninitialized values Packet::IP()-created IP_Hdr should not free Make enums work for non-C++11 config Refactor to make bro use a common Packet object. Do a better job of parsing layer 2 and keeping track of layer 3 proto. Add support for raw packet event, including Layer2 headers. Conflicts: aux/plugins
This commit is contained in:
commit
fe3579f1b4
34 changed files with 572 additions and 431 deletions
|
@ -101,8 +101,12 @@ bool PcapDumper::Dump(const Packet* pkt)
|
|||
if ( ! dumper )
|
||||
return false;
|
||||
|
||||
pcap_dump((u_char*) dumper, pkt->hdr, pkt->data);
|
||||
// Reconstitute the pcap_pkthdr.
|
||||
const struct pcap_pkthdr phdr = {
|
||||
.ts = pkt->ts, .caplen = pkt->cap_len, .len = pkt->len
|
||||
};
|
||||
|
||||
pcap_dump((u_char*) dumper, &phdr, pkt->data);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -167,9 +167,8 @@ bool PcapSource::ExtractNextPacket(Packet* pkt)
|
|||
return false;
|
||||
}
|
||||
|
||||
pkt->ts = current_hdr.ts.tv_sec + double(current_hdr.ts.tv_usec) / 1e6;
|
||||
pkt->hdr = ¤t_hdr;
|
||||
pkt->data = last_data = data;
|
||||
last_data = data;
|
||||
pkt->Init(props.link_type, ¤t_hdr.ts, current_hdr.caplen, current_hdr.len, data);
|
||||
|
||||
if ( current_hdr.len == 0 || current_hdr.caplen == 0 )
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue