mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 03:58:20 +00:00
Accept bracketed ipv6 addresses
This commit is contained in:
parent
8f4138262f
commit
211789bbb3
3 changed files with 16 additions and 6 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue