Merge remote-tracking branch 'origin/topic/awelzel/4605-conn-id-context'

* origin/topic/awelzel/4605-conn-id-context:
  NEWS: Adapt for conn_id$ctx introduction
  conn_key/fivetuple: Drop support for non conn_id records
  Conn: Move conn_id init and flip to IPBasedConnKey
  IPBasedConnKey: Add GetTransportProto() helper
  input/Manager: Ignore empty record types
  external: Bump commit hashes for external suites
  ip/vlan_fivetuple: Populate nested conn_id_context, not conn_id
  ConnKey: Extend DoPopulateConnIdVal() with ctx
  btest: Update tests and baselines after adding ctx to conn_id
  init-bare: Add conn_id_ctx to conn_id
This commit is contained in:
Arne Welzel 2025-07-03 18:41:29 +02:00
commit 388cbcee48
284 changed files with 96941 additions and 96655 deletions

View file

@ -0,0 +1,50 @@
# @TEST-DOC: Check that empty record types are ignored.
#
# @TEST-EXEC: zeek -b %INPUT >out
# @TEST-EXEC: btest-diff .stderr
# @TEST-EXEC: btest-diff out
# @TEST-START-FILE input.log
#separator \x09
#path ssh
#fields s r0.c0 r0.c1 r0.s
#types string count string
string1 4242 4711 r0s-1
string2 4343 - r0s-2
# @TEST-END-FILE
redef exit_only_after_terminate = T;
module Test;
type EmptyRec: record { };
type MyRec: record {
e0: EmptyRec; # stuffing
c0: count;
c1: count &optional;
e1: EmptyRec; # stuffing
s: string;
};
type Val: record {
s: string;
e0: EmptyRec; # stuffing
r0: MyRec;
e1: EmptyRec; # stuffing
};
event Test::line(description: Input::EventDescription, tpe: Input::Event, v: Val)
{
print tpe, v;
}
event Input::end_of_data(name: string, source:string)
{
terminate();
}
event zeek_init()
{
Input::add_event([$source="input.log", $name="file", $fields=Val, $ev=Test::line]);
}

View file

@ -4,7 +4,7 @@
@load base/utils/conn-ids
global c: conn_id = [ $orig_h = 10.0.0.100, $orig_p = 10000/tcp,
$resp_h = 10.0.0.200, $resp_p = 20000/tcp, $proto=6 ];
$resp_h = 10.0.0.200, $resp_p = 20000/tcp, $proto=6, $ctx=[] ];
print id_string(c);
print reverse_id_string(c);

View file

@ -11,19 +11,19 @@ global remote_ip = 192.168.1.100;
global local2local: conn_id = [
$orig_h = 10.0.0.100, $orig_p = 10000/tcp,
$resp_h = 10.0.0.200, $resp_p = 20000/tcp, $proto=6 ];
$resp_h = 10.0.0.200, $resp_p = 20000/tcp, $proto=6, $ctx=[] ];
global local2remote: conn_id = [
$orig_h = 10.0.0.100, $orig_p = 10000/tcp,
$resp_h = 192.168.1.100, $resp_p = 20000/tcp, $proto=6 ];
$resp_h = 192.168.1.100, $resp_p = 20000/tcp, $proto=6, $ctx=[] ];
global remote2local: conn_id = [
$orig_h = 192.168.1.100, $orig_p = 10000/tcp,
$resp_h = 10.0.0.100, $resp_p = 20000/tcp, $proto=6 ];
$resp_h = 10.0.0.100, $resp_p = 20000/tcp, $proto=6, $ctx=[] ];
global remote2remote: conn_id = [
$orig_h = 192.168.1.100, $orig_p = 10000/tcp,
$resp_h = 192.168.1.200, $resp_p = 20000/tcp, $proto=6 ];
$resp_h = 192.168.1.200, $resp_p = 20000/tcp, $proto=6, $ctx=[] ];
function test_host(ip: addr, h: Host, expect: bool)
{