diff --git a/src/threading/Formatter.cc b/src/threading/Formatter.cc index 17e015452d..49b6ac1c7a 100644 --- a/src/threading/Formatter.cc +++ b/src/threading/Formatter.cc @@ -80,9 +80,12 @@ threading::Value::addr_t Formatter::ParseAddr(const std::string &s) const else { val.family = IPv6; - if ( inet_pton(AF_INET6, s.c_str(), val.in.in6.s6_addr) <=0 ) + std::string clean_s = s; + if(s.front() == '[' && s.back() == ']') + clean_s = s.substr(1, s.length() - 2); + if ( inet_pton(AF_INET6, clean_s.c_str(), val.in.in6.s6_addr) <=0 ) { - thread->Warning(thread->Fmt("Bad address: %s", s.c_str())); + thread->Warning(thread->Fmt("Bad address: %s", clean_s.c_str())); memset(val.in.in6.s6_addr, 0, sizeof(val.in.in6.s6_addr)); } } diff --git a/testing/btest/Baseline/scripts.base.frameworks.config.basic/zeek.config.log b/testing/btest/Baseline/scripts.base.frameworks.config.basic/zeek.config.log index 07ccf3e703..0abe2e20b0 100644 --- a/testing/btest/Baseline/scripts.base.frameworks.config.basic/zeek.config.log +++ b/testing/btest/Baseline/scripts.base.frameworks.config.basic/zeek.config.log @@ -3,7 +3,7 @@ #empty_field (empty) #unset_field - #path config -#open 2018-08-10-18-16-52 +#open 2020-08-05-21-07-37 #fields ts id old_value new_value location #types time string string string string 1533925012.140634 testbool T F ../configfile @@ -15,11 +15,14 @@ 1533925012.140634 testporttcp 40/udp 42/tcp ../configfile 1533925012.140634 testportudp 40/tcp 42/udp ../configfile 1533925012.140634 testaddr 127.0.0.1 127.0.0.1 ../configfile -1533925012.140634 testaddr 127.0.0.1 2607:f8b0:4005:801::200e ../configfile +1533925012.140634 testaddr 127.0.0.1 2607:f8b0:4005:801::1 ../configfile +1533925012.140634 testaddr 2607:f8b0:4005:801::1 2607:f8b0:4005:801::2 ../configfile +1533925012.140634 testsub 0.0.0.0/0 2607:f8b0:4001::/48 ../configfile +1533925012.140634 testsub 2607:f8b0:4001::/48 2607:f8b0:4002::/48 ../configfile 1533925012.140634 testinterval 1.0 sec 1.0 min ../configfile 1533925012.140634 testtime 0.0 1507321987.0 ../configfile 1533925012.140634 test_set (empty) b,c,a,d,erdbeerschnitzel ../configfile 1533925012.140634 test_vector (empty) 1,2,3,4,5,6 ../configfile 1533925012.140634 test_set b,c,a,d,erdbeerschnitzel (empty) ../configfile 1533925012.140634 test_set (empty) \x2d ../configfile -#close 2018-08-10-18-16-52 +#close 2020-08-05-21-07-37 diff --git a/testing/btest/scripts/base/frameworks/config/basic.zeek b/testing/btest/scripts/base/frameworks/config/basic.zeek index 0195388792..384d4a3303 100644 --- a/testing/btest/scripts/base/frameworks/config/basic.zeek +++ b/testing/btest/scripts/base/frameworks/config/basic.zeek @@ -20,7 +20,10 @@ testport 45 testporttcp 42/tcp testportudp 42/udp testaddr 127.0.0.1 -testaddr 2607:f8b0:4005:801::200e +testaddr 2607:f8b0:4005:801::1 +testaddr [2607:f8b0:4005:801::2] +testsub 2607:f8b0:4001:801::/48 +testsub [2607:f8b0:4002:801::]/48 testinterval 60 testtime 1507321987 test_set a,b,c,d,erdbeerschnitzel @@ -41,6 +44,7 @@ export { option testporttcp = 40/udp; option testportudp = 40/tcp; option testaddr = 127.0.0.1; + option testsub = 0.0.0.0/0; option testtime = network_time(); option testinterval = 1sec; option teststring = "a";