mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Merge remote-tracking branch 'origin/topic/jsiwek/gh-514-improve-addr-conversion-errors'
* origin/topic/jsiwek/gh-514-improve-addr-conversion-errors: Improve error messages from to_addr and to_subnet BIFs
This commit is contained in:
commit
ca36728a4e
9 changed files with 115 additions and 30 deletions
|
@ -1 +1 @@
|
|||
error: Bad IP address: not an IP
|
||||
error in /home/jon/pro/zeek/zeek/testing/btest/.tmp/bifs.to_addr/to_addr.zeek, line 7 and /home/jon/pro/zeek/zeek/testing/btest/.tmp/bifs.to_addr/to_addr.zeek, line 20: failed converting string to IP address (to_addr(ip) and not an IP)
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
error: Bad string in SubNetVal ctor: 10.0.0.0
|
||||
error in /home/jon/pro/zeek/zeek/testing/btest/.tmp/bifs.to_subnet/to_subnet.zeek, line 10: failed converting string to IP prefix (to_subnet(10.0.0.0) and 10.0.0.0)
|
||||
error in /home/jon/pro/zeek/zeek/testing/btest/.tmp/bifs.to_subnet/to_subnet.zeek, line 12: failed converting string to IP prefix (to_subnet(10.0.0.0/222) and 10.0.0.0/222)
|
||||
error in /home/jon/pro/zeek/zeek/testing/btest/.tmp/bifs.to_subnet/to_subnet.zeek, line 14: failed converting string to IP prefix (to_subnet(don't work) and don't work)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
10.0.0.0/8, T
|
||||
2607:f8b0::/32, T
|
||||
::/0, T
|
||||
::/0, T
|
||||
::/0, T
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >output 2>error
|
||||
# @TEST-EXEC: btest-diff output
|
||||
# @TEST-EXEC: btest-diff error
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff error
|
||||
|
||||
function test_to_addr(ip: string, expect: addr)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >output 2>error
|
||||
# @TEST-EXEC: btest-diff output
|
||||
# @TEST-EXEC: btest-diff error
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff error
|
||||
|
||||
global sn: subnet;
|
||||
sn = to_subnet("10.0.0.0/8");
|
||||
|
@ -9,3 +9,7 @@ sn = to_subnet("2607:f8b0::/32");
|
|||
print sn, sn == [2607:f8b0::]/32;
|
||||
sn = to_subnet("10.0.0.0");
|
||||
print sn, sn == [::]/0;
|
||||
sn = to_subnet("10.0.0.0/222");
|
||||
print sn, sn == [::]/0;
|
||||
sn = to_subnet("don't work");
|
||||
print sn, sn == [::]/0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue