mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00

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
24 lines
578 B
Text
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;
|
|
}
|
|
|