mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 12:38:20 +00:00
Ascii formatter: do not complain about port text.
The ascii formatter already was happy to read ports in the form "42/tcp"; however it emitted a warning message for each line. This patch fixes this and adds a bit more testing for the existing behavior.
This commit is contained in:
parent
116079a9ad
commit
26ea1999ec
7 changed files with 88 additions and 16 deletions
|
@ -1,6 +1,7 @@
|
|||
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: btest-diff bro/config.log
|
||||
# @TEST-EXEC: btest-diff bro/.stderr
|
||||
|
||||
@load base/frameworks/config
|
||||
@load base/protocols/conn
|
||||
|
@ -16,6 +17,8 @@ testcount 2
|
|||
testint -1
|
||||
testenum Conn::LOG
|
||||
testport 45
|
||||
testporttcp 42/tcp
|
||||
testportudp 42/udp
|
||||
testaddr 127.0.0.1
|
||||
testaddr 2607:f8b0:4005:801::200e
|
||||
testinterval 60
|
||||
|
@ -35,6 +38,8 @@ export {
|
|||
option testint: int = 0;
|
||||
option testenum = SSH::LOG;
|
||||
option testport = 42/tcp;
|
||||
option testporttcp = 40/udp;
|
||||
option testportudp = 40/tcp;
|
||||
option testaddr = 127.0.0.1;
|
||||
option testtime = network_time();
|
||||
option testinterval = 1sec;
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: btest-diff bro/.stdout
|
||||
# @TEST-EXEC: btest-diff bro/.stderr
|
||||
|
||||
@TEST-START-FILE input.log
|
||||
#fields i p
|
||||
1.2.3.4 80/tcp
|
||||
1.2.3.5 52/udp
|
||||
1.2.3.6 30/unknown
|
||||
1.2.3.7 50/trash
|
||||
@TEST-END-FILE
|
||||
|
||||
redef exit_only_after_terminate = T;
|
||||
|
||||
redef InputAscii::empty_field = "EMPTY";
|
||||
|
||||
module A;
|
||||
|
||||
type Idx: record {
|
||||
i: addr;
|
||||
};
|
||||
|
||||
type Val: record {
|
||||
p: port;
|
||||
};
|
||||
|
||||
global servers: table[addr] of Val = table();
|
||||
|
||||
event line(description: Input::TableDescription, tpe: Input::Event, left: Idx, right: Val)
|
||||
{
|
||||
print left, right;
|
||||
}
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
Input::add_table([$source="../input.log", $name="input", $idx=Idx, $val=Val, $ev=line, $destination=servers]);
|
||||
}
|
||||
|
||||
event Input::end_of_data(name: string, source: string)
|
||||
{
|
||||
Input::remove("input");
|
||||
terminate();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue