mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +00:00
Renamed LL-Analyzers to Packet Analyzers.
This commit is contained in:
parent
b2e6c9ac9a
commit
e53ec46c23
148 changed files with 587 additions and 587 deletions
31
src/packet_analysis/protocol/vlan/VLAN.cc
Normal file
31
src/packet_analysis/protocol/vlan/VLAN.cc
Normal file
|
@ -0,0 +1,31 @@
|
|||
// See the file "COPYING" in the main distribution directory for copyright.
|
||||
|
||||
#include "VLAN.h"
|
||||
#include "NetVar.h"
|
||||
|
||||
using namespace zeek::packet_analysis::VLAN;
|
||||
|
||||
VLANAnalyzer::VLANAnalyzer()
|
||||
: zeek::packet_analysis::Analyzer("VLAN")
|
||||
{
|
||||
}
|
||||
|
||||
std::tuple<zeek::packet_analysis::AnalyzerResult, zeek::packet_analysis::identifier_t> VLANAnalyzer::Analyze(Packet* packet)
|
||||
{
|
||||
auto& pdata = packet->cur_pos;
|
||||
|
||||
if ( pdata + 4 >= packet->GetEndOfData() )
|
||||
{
|
||||
packet->Weird("truncated_VLAN_header");
|
||||
return { AnalyzerResult::Failed, 0 };
|
||||
}
|
||||
|
||||
auto& vlan_ref = packet->vlan != 0 ? packet->inner_vlan : packet->vlan;
|
||||
vlan_ref = ((pdata[0] << 8u) + pdata[1]) & 0xfff;
|
||||
|
||||
identifier_t protocol = ((pdata[2] << 8u) + pdata[3]);
|
||||
packet->eth_type = protocol;
|
||||
pdata += 4; // Skip the VLAN header
|
||||
|
||||
return { AnalyzerResult::Continue, protocol };
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue