mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
Reformat Zeek in Spicy style
This largely copies over Spicy's `.clang-format` configuration file. The one place where we deviate is header include order since Zeek depends on headers being included in a certain order.
This commit is contained in:
parent
7b8e7ed72c
commit
f5a76c1aed
786 changed files with 131714 additions and 153609 deletions
|
@ -4,27 +4,25 @@
|
|||
|
||||
using namespace zeek::packet_analysis::LinuxSLL;
|
||||
|
||||
LinuxSLLAnalyzer::LinuxSLLAnalyzer() : zeek::packet_analysis::Analyzer("LinuxSLL") { }
|
||||
LinuxSLLAnalyzer::LinuxSLLAnalyzer() : zeek::packet_analysis::Analyzer("LinuxSLL") {}
|
||||
|
||||
bool LinuxSLLAnalyzer::AnalyzePacket(size_t len, const uint8_t* data, Packet* packet)
|
||||
{
|
||||
auto len_sll_hdr = sizeof(SLLHeader);
|
||||
if ( len_sll_hdr >= len )
|
||||
{
|
||||
Weird("truncated_Linux_SLL_header", packet);
|
||||
return false;
|
||||
}
|
||||
bool LinuxSLLAnalyzer::AnalyzePacket(size_t len, const uint8_t* data, Packet* packet) {
|
||||
auto len_sll_hdr = sizeof(SLLHeader);
|
||||
if ( len_sll_hdr >= len ) {
|
||||
Weird("truncated_Linux_SLL_header", packet);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Note: We assume to see an Ethertype and don't consider different ARPHRD_types
|
||||
// (see https://www.tcpdump.org/linktypes/LINKTYPE_LINUX_SLL.html)
|
||||
auto hdr = (const SLLHeader*)data;
|
||||
// Note: We assume to see an Ethertype and don't consider different ARPHRD_types
|
||||
// (see https://www.tcpdump.org/linktypes/LINKTYPE_LINUX_SLL.html)
|
||||
auto hdr = (const SLLHeader*)data;
|
||||
|
||||
uint32_t protocol = ntohs(hdr->protocol_type);
|
||||
packet->l2_src = (u_char*)&(hdr->addr);
|
||||
uint32_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;
|
||||
// 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;
|
||||
|
||||
return ForwardPacket(len - len_sll_hdr, data + len_sll_hdr, packet, protocol);
|
||||
}
|
||||
return ForwardPacket(len - len_sll_hdr, data + len_sll_hdr, packet, protocol);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue