mirror of
https://github.com/zeek/zeek.git
synced 2025-10-16 21:48:21 +00:00
Decrease strictness of parsing IPv4 strings into addrs. (fixes #775)
IPv4 strings in dotted-decimal format with decimal parts containing leading zeroes now parse better.
This commit is contained in:
parent
1f7bfbb83c
commit
b66b74e5dc
4 changed files with 72 additions and 1 deletions
8
testing/btest/Baseline/bifs.to_addr/output
Normal file
8
testing/btest/Baseline/bifs.to_addr/output
Normal file
|
@ -0,0 +1,8 @@
|
|||
to_addr(0.0.0.0) = 0.0.0.0 (SUCCESS)
|
||||
to_addr(1.2.3.4) = 1.2.3.4 (SUCCESS)
|
||||
to_addr(01.02.03.04) = 1.2.3.4 (SUCCESS)
|
||||
to_addr(001.002.003.004) = 1.2.3.4 (SUCCESS)
|
||||
to_addr(10.20.30.40) = 10.20.30.40 (SUCCESS)
|
||||
to_addr(100.200.30.40) = 100.200.30.40 (SUCCESS)
|
||||
to_addr(10.0.0.0) = 10.0.0.0 (SUCCESS)
|
||||
to_addr(10.00.00.000) = 10.0.0.0 (SUCCESS)
|
18
testing/btest/bifs/to_addr.bro
Normal file
18
testing/btest/bifs/to_addr.bro
Normal file
|
@ -0,0 +1,18 @@
|
|||
# @TEST-EXEC: bro %INPUT >output
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
function test_to_addr(ip: string, expect: addr)
|
||||
{
|
||||
local result = to_addr(ip);
|
||||
print fmt("to_addr(%s) = %s (%s)", ip, result,
|
||||
result == expect ? "SUCCESS" : "FAILURE");
|
||||
}
|
||||
|
||||
test_to_addr("0.0.0.0", 0.0.0.0);
|
||||
test_to_addr("1.2.3.4", 1.2.3.4);
|
||||
test_to_addr("01.02.03.04", 1.2.3.4);
|
||||
test_to_addr("001.002.003.004", 1.2.3.4);
|
||||
test_to_addr("10.20.30.40", 10.20.30.40);
|
||||
test_to_addr("100.200.30.40", 100.200.30.40);
|
||||
test_to_addr("10.0.0.0", 10.0.0.0);
|
||||
test_to_addr("10.00.00.000", 10.0.0.0);
|
Loading…
Add table
Add a link
Reference in a new issue