Merge remote-tracking branch 'origin' into topic/bernhard/input-threads

This commit is contained in:
Bernhard Amann 2012-03-22 12:41:44 -07:00
commit e7f1200f9f
26 changed files with 117 additions and 277 deletions

View file

@ -0,0 +1,22 @@
::1
::ffff
::255.255.255.255
::10.10.255.255
1::1
1::a
1::1:1
1::1:a
a::a
a::1
a::a:a
a::a:1
a:a::a
aaaa::ffff
192.168.1.100
ffff::c0a8:164
::192.168.1.100
805b:2d9d:dc28::fc57:d4c8:1fff
aaaa::bbbb
aaaa:bbbb:cccc:dddd:eeee:ffff:1111:2222
aaaa:bbbb:cccc:dddd:eeee:ffff:1:2222
aaaa:bbbb:cccc:dddd:eeee:ffff:0:2222

View file

@ -1,3 +0,0 @@
default
it's big
it's really big

View file

@ -3,7 +3,7 @@
global v: index_vec;
v = addr_to_counts(2001:0db8:85a3:0000:0000:8a2e:0370:7334);
v = addr_to_counts([2001:0db8:85a3:0000:0000:8a2e:0370:7334]);
print v;
print counts_to_addr(v);
v = addr_to_counts(1.2.3.4);

View file

@ -1,6 +1,6 @@
# @TEST-EXEC: bro %INPUT >output
# @TEST-EXEC: btest-diff output
print addr_to_ptr_name(2607:f8b0:4009:802::1012);
print addr_to_ptr_name([2607:f8b0:4009:802::1012]);
print addr_to_ptr_name(74.125.225.52);

View file

@ -2,6 +2,6 @@
# @TEST-EXEC: btest-diff out
print is_v4_addr(1.2.3.4);
print is_v4_addr(::1);
print is_v4_addr([::1]);
print is_v6_addr(1.2.3.4);
print is_v6_addr(::1);
print is_v6_addr([::1]);

View file

@ -17,4 +17,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);
test_to_addr("not an IP", ::);
test_to_addr("not an IP", [::]);

View file

@ -6,6 +6,6 @@ global sn: subnet;
sn = to_subnet("10.0.0.0/8");
print sn, sn == 10.0.0.0/8;
sn = to_subnet("2607:f8b0::/32");
print sn, sn == 2607:f8b0::/32;
print sn, sn == [2607:f8b0::]/32;
sn = to_subnet("10.0.0.0");
print sn, sn == ::/0;
print sn, sn == [::]/0;

View file

@ -0,0 +1,30 @@
# @TEST-EXEC: bro -b %INPUT >output
# @TEST-EXEC: btest-diff output
local v: vector of addr = vector();
v[|v|] = [::1];
v[|v|] = [::ffff];
v[|v|] = [::ffff:ffff];
v[|v|] = [::0a0a:ffff];
v[|v|] = [1::1];
v[|v|] = [1::a];
v[|v|] = [1::1:1];
v[|v|] = [1::1:a];
v[|v|] = [a::a];
v[|v|] = [a::1];
v[|v|] = [a::a:a];
v[|v|] = [a::a:1];
v[|v|] = [a:a::a];
v[|v|] = [aaaa:0::ffff];
v[|v|] = [::ffff:192.168.1.100];
v[|v|] = [ffff::192.168.1.100];
v[|v|] = [::192.168.1.100];
v[|v|] = [805B:2D9D:DC28::FC57:212.200.31.255];
v[|v|] = [0xaaaa::bbbb];
v[|v|] = [aaaa:bbbb:cccc:dddd:eeee:ffff:1111:2222];
v[|v|] = [aaaa:bbbb:cccc:dddd:eeee:ffff:1:2222];
v[|v|] = [aaaa:bbbb:cccc:dddd:eeee:ffff:0:2222];
for (i in v)
print v[i];

View file

@ -1,20 +0,0 @@
# @TEST-EXEC: bro %INPUT >output 2>&1
# @TEST-EXEC: btest-diff output
global match_stuff = {
[$pred(a: count) = { return a > 5; },
$result = "it's big",
$priority = 2],
[$pred(a: count) = { return a > 15; },
$result = "it's really big",
$priority = 3],
[$pred(a: count) = { return T; },
$result = "default",
$priority = 0],
};
print match 0 using match_stuff;
print match 10 using match_stuff;
print match 20 using match_stuff;

View file

@ -1,51 +0,0 @@
# @TEST-EXEC: bro %INPUT >output 2>&1
# @TEST-EXEC: btest-diff output
type fakealert : record {
alert: string;
};
type match_rec : record {
result : count;
pred : function(rec : fakealert) : bool;
priority: count;
};
#global test_set : set[int] =
#{
#1, 2, 3
#};
global match_set : set[match_rec] =
{
[$result = 1, $pred(a: fakealert) = { return T; }, $priority = 8 ],
[$result = 2, $pred(a: fakealert) = { return T; }, $priority = 9 ]
};
global al : fakealert;
#global testset : set[fakealert] =
#{
# [$alert="hithere"]
#};
type nonalert: record {
alert : string;
pred : function(a : int) : int;
};
#global na : nonalert;
#na$alert = "5";
#al$alert = "hithere2";
#if (al in testset)
# print 1;
#else
# print 0;
al$alert = "hi";
print (match al using match_set);

View file

@ -20,7 +20,7 @@ type example_record: record {
};
global a: addr = 1.2.3.4;
global a6: addr = ::1;
global a6: addr = [::1];
global b: bool = T;
global c: count = 10;
global d: double = -1.23;