mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 23:28:20 +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
34
src/packet_analysis/protocol/linux_sll/LinuxSLL.cc
Normal file
34
src/packet_analysis/protocol/linux_sll/LinuxSLL.cc
Normal file
|
@ -0,0 +1,34 @@
|
|||
// See the file "COPYING" in the main distribution directory for copyright.
|
||||
|
||||
#include "LinuxSLL.h"
|
||||
|
||||
using namespace zeek::packet_analysis::LinuxSLL;
|
||||
|
||||
LinuxSLLAnalyzer::LinuxSLLAnalyzer()
|
||||
: zeek::packet_analysis::Analyzer("LinuxSLL")
|
||||
{
|
||||
}
|
||||
|
||||
std::tuple<zeek::packet_analysis::AnalyzerResult, zeek::packet_analysis::identifier_t> LinuxSLLAnalyzer::Analyze(Packet* packet)
|
||||
{
|
||||
auto& pdata = packet->cur_pos;
|
||||
|
||||
if ( pdata + sizeof(SLLHeader) >= packet->GetEndOfData() )
|
||||
{
|
||||
packet->Weird("truncated_Linux_SLL_header");
|
||||
return { AnalyzerResult::Failed, 0 };
|
||||
}
|
||||
|
||||
//TODO: Handle different ARPHRD_types
|
||||
auto hdr = (const SLLHeader*)pdata;
|
||||
|
||||
identifier_t protocol = ntohs(hdr->protocol_type);
|
||||
packet->l2_src = (u_char*) &(hdr->addr);
|
||||
|
||||
// SLL doesn't include a destination address in the header, but not setting l2_dst to something
|
||||
// here will cause crashes elsewhere.
|
||||
packet->l2_dst = Packet::L2_EMPTY_ADDR;
|
||||
|
||||
pdata += sizeof(SLLHeader);
|
||||
return { AnalyzerResult::Continue, protocol };
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue