mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +00:00
Improve packet analyzer API.
This commit is contained in:
parent
d5ca0f9da5
commit
90eb97876f
40 changed files with 138 additions and 136 deletions
|
@ -10,9 +10,10 @@ VLANAnalyzer::VLANAnalyzer()
|
|||
{
|
||||
}
|
||||
|
||||
zeek::packet_analysis::AnalyzerResult VLANAnalyzer::Analyze(Packet* packet, const uint8_t*& data)
|
||||
zeek::packet_analysis::AnalyzerResult VLANAnalyzer::AnalyzePacket(size_t len,
|
||||
const uint8_t* data, Packet* packet)
|
||||
{
|
||||
if ( data + 4 >= packet->GetEndOfData() )
|
||||
if ( 4 >= len )
|
||||
{
|
||||
packet->Weird("truncated_VLAN_header");
|
||||
return AnalyzerResult::Failed;
|
||||
|
@ -23,7 +24,6 @@ zeek::packet_analysis::AnalyzerResult VLANAnalyzer::Analyze(Packet* packet, cons
|
|||
|
||||
uint32_t protocol = ((data[2] << 8u) + data[3]);
|
||||
packet->eth_type = protocol;
|
||||
data += 4; // Skip the VLAN header
|
||||
|
||||
return AnalyzeInnerPacket(packet, data, protocol);
|
||||
// Skip the VLAN header
|
||||
return ForwardPacket(len - 4, data + 4, packet, protocol);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue