zeek/scripts/policy/protocols/conn/pppoe-session-id-logging.zeek
Johanna Amann 3e4f67e67c Move Conn::set_conn() from connection_state_remove to new_connection
c$conn is often needed for connection events, but it being established
in connection_state_removed can be a problem because event handlers have
to remember to call Con::set_conn().

This commit moves to call Conn::set_conn() in new_connection.

Addresses GH-4202

update logs
2025-07-29 09:11:57 +01:00

24 lines
578 B
Text

##! This script adds PPPoE session ID information to the connection log.
@load base/protocols/conn
module Conn;
redef record Info += {
## The PPPoE session id, if applicable for this connection.
pppoe_session_id: count &log &optional;
};
# Add the PPPoE session ID to the Conn::Info structure. We have to do this right
# at the beginning, while we are handling a packet.
event new_connection(c: connection)
{
local session_id = PacketAnalyzer::PPPoE::session_id();
# no session ID
if ( session_id == 0xFFFFFFFF )
return;
c$conn$pppoe_session_id = session_id;
}