scan.l: Deprecate DNS resolutions of hostname literals

This also skips DNS lookups when running with zeek --parse-only.

Closes #4216 #4219
This commit is contained in:
Arne Welzel 2025-03-04 11:13:25 +01:00
parent e14f54b474
commit 715c309b03
12 changed files with 52 additions and 4 deletions

View file

@ -1,9 +1,11 @@
# We once had a bug where DNS lookups at init time lead to an immediate crash.
#
# @TEST-EXEC: zeek -b %INPUT >output 2>&1
# @TEST-EXEC: btest-diff output
# @TEST-EXEC: zeek -b %INPUT
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff .stderr
# @TEST-EXEC: btest-diff .stdout
const foo: set[addr] = {
google.com
};
print foo;

View file

@ -1,5 +1,6 @@
# @TEST-EXEC: ZEEK_DNS_FAKE=1 zeek -D -b %INPUT >out
# @TEST-EXEC: ZEEK_DNS_FAKE=1 zeek -D -b %INPUT >out 2>err
# @TEST-EXEC: btest-diff out
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff err
redef exit_only_after_terminate = T;

View file

@ -0,0 +1,11 @@
# @TEST-DOC: Testing deprecated hostname literal resolutions
#
# @TEST-EXEC: zeek --parse-only -b %INPUT 2>err.parse-only >out.parse-only
# @TEST-EXEC: zeek -b %INPUT 2>err >out
#
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff err.parse-only
# @TEST-EXEC: btest-diff out.parse-only
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff err
# @TEST-EXEC: btest-diff out
print "dns.example.com", dns.example.com;