mirror of
https://github.com/zeek/zeek.git
synced 2025-10-17 05:58:20 +00:00
Merge remote-tracking branch 'origin/topic/johanna/pppoe-session-id-logging'
* origin/topic/johanna/pppoe-session-id-logging: Update external tests for pppoe-session-id conn.log changes PPPoE: add session id logging
This commit is contained in:
commit
4399f171ae
15 changed files with 91 additions and 5 deletions
|
@ -1,3 +1,4 @@
|
|||
zeek_add_plugin(
|
||||
PacketAnalyzer PPPoE
|
||||
SOURCES PPPoE.cc Plugin.cc)
|
||||
Zeek PPPoE
|
||||
SOURCES PPPoE.cc Plugin.cc
|
||||
BIFS functions.bif)
|
||||
|
|
22
src/packet_analysis/protocol/pppoe/functions.bif
Normal file
22
src/packet_analysis/protocol/pppoe/functions.bif
Normal file
|
@ -0,0 +1,22 @@
|
|||
module PacketAnalyzer::PPPoE;
|
||||
|
||||
%%{
|
||||
#include "zeek/packet_analysis/Manager.h"
|
||||
%%}
|
||||
|
||||
## Returns the PPPoE Session ID of the current packet, if present.
|
||||
##
|
||||
## If no PPPoE Session ID is present, 0xFFFFFFFF is returned, which
|
||||
## is out of range of the session ID.
|
||||
##
|
||||
## Returns: The PPPoE session ID if present, 0xFFFFFFFF otherwise.
|
||||
function session_id%(%): count
|
||||
%{
|
||||
static const auto& analyzer = zeek::packet_mgr->GetAnalyzer("PPPoE");
|
||||
auto spans = zeek::packet_mgr->GetAnalyzerData(analyzer);
|
||||
|
||||
if ( spans.size() == 0 || spans[0].size() <=8 )
|
||||
return zeek::val_mgr->Count(0xFFFFFFFF);
|
||||
|
||||
return zeek::val_mgr->Count((spans[0][2] << 8u) + spans[0][3]);
|
||||
%}
|
Loading…
Add table
Add a link
Reference in a new issue