Merge branch 'master' into topic/jsiwek/ipv6-ext-headers

This commit is contained in:
Jon Siwek 2012-03-19 14:26:59 -05:00
commit f11fca588e
17 changed files with 99 additions and 19 deletions

13
CHANGES
View file

@ -1,4 +1,17 @@
2.0-150 | 2012-03-13 16:16:22 -0700
* Changing the regular expression to allow Site::local_nets in
signatures. (Julien Sentier)
* Removing a line of dead code. Found by . Closes #786. (Julien
Sentier)
2.0-146 | 2012-03-13 15:39:38 -0700
* Change IPv6 literal constant syntax to require encasing square
brackets. (Jon Siwek)
2.0-145 | 2012-03-09 15:10:35 -0800
* Remove the match expression. 'match' and 'using' are no longer

3
NEWS
View file

@ -28,6 +28,9 @@ Bro 2.1
the default scripts, nor was it likely to be used by anybody anytime
soon. With that, "match" and "using" are no longer reserved keywords.
- The syntax for IPv6 literals changed from "2607:f8b0:4009:802::1012"
to "[2607:f8b0:4009:802::1012]".
TODO: Extend.
Bro 2.0

View file

@ -1 +1 @@
2.0-145
2.0-150

@ -1 +1 @@
Subproject commit ca13601450803b48d70122609764e51252a0d86e
Subproject commit a08ca90727c5c4b90aa8633106ec33a5cf7378d4

@ -1 +1 @@
Subproject commit ee87db37b520b88a55323a9767234c30b801e439
Subproject commit 9c9fde204dd5518bdfdb8b4a86d38ed06e597209

View file

@ -275,7 +275,7 @@ event ftp_reply(c: connection, code: count, msg: string, cont_resp: bool) &prior
{
c$ftp$passive=T;
if ( code == 229 && data$h == :: )
if ( code == 229 && data$h == [::] )
data$h = id$resp_h;
ftp_data_expected[data$h, data$p] = c$ftp;

View file

@ -352,7 +352,6 @@ void SMTP_Analyzer::ProcessLine(int length, const char* line, bool orig)
const char* ext;
int ext_len;
line = skip_whitespace(line + ext_len, end_of_line);
get_word(end_of_line - line, line, ext_len, ext);
ProcessExtension(ext_len, ext);
}

View file

@ -18,7 +18,7 @@ WS [ \t]+
D [0-9]+
H [0-9a-fA-F]+
STRING \"([^\n\"]|\\\")*\"
ID [0-9a-zA-Z_-]+
ID ([0-9a-zA-Z_-]+::)*[0-9a-zA-Z_-]+
RE \/(\\\/)?([^/]|[^\\]\\\/)*\/
META \.[^ \t]+{WS}[^\n]+
PID ([0-9a-zA-Z_-]|"::")+

View file

@ -228,6 +228,24 @@ ESCSEQ (\\([^\n]|[0-7]+|x[[:xdigit:]]+))
++yylloc.last_line;
}
/* IPv6 literal constant patterns */
"["({HEX}:){7}{HEX}"]" {
string s(yytext+1);
RET_CONST(new AddrVal(s.erase(s.size()-1)))
}
"["0x{HEX}({HEX}|:)*"::"({HEX}|:)*"]" {
string s(yytext+3);
RET_CONST(new AddrVal(s.erase(s.size()-1)))
}
"["({HEX}|:)*"::"({HEX}|:)*"]" {
string s(yytext+1);
RET_CONST(new AddrVal(s.erase(s.size()-1)))
}
"["({HEX}|:)*"::"({HEX}|:)*({D}"."){3}{D}"]" {
string s(yytext+1);
RET_CONST(new AddrVal(s.erase(s.size()-1)))
}
[!%*/+\-,:;<=>?()\[\]{}~$|] return yytext[0];
"--" return TOK_DECR;
@ -448,11 +466,6 @@ F RET_CONST(new Val(false, TYPE_BOOL))
({D}"."){3}{D} RET_CONST(new AddrVal(yytext))
({HEX}:){7}{HEX} RET_CONST(new AddrVal(yytext))
0x{HEX}({HEX}|:)*"::"({HEX}|:)* RET_CONST(new AddrVal(yytext+2))
(({D}|:)({HEX}|:)*)?"::"({HEX}|:)* RET_CONST(new AddrVal(yytext))
"0x"{HEX}+ RET_CONST(new Val(static_cast<bro_uint_t>(strtol(yytext, 0, 16)), TYPE_COUNT))
{H}("."{H})+ RET_CONST(dns_mgr->LookupHost(yytext))

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

@ -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

@ -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;