mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 11:08:20 +00:00
Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath: Remove unnecessary assert in ICMP analyzer (addresses #822). Improve script debugger backtrace and print commands.
This commit is contained in:
commit
e9354284eb
10 changed files with 92 additions and 12 deletions
45
CHANGES
45
CHANGES
|
@ -1,4 +1,49 @@
|
|||
|
||||
2.0-395 | 2012-05-30 17:03:31 -0700
|
||||
|
||||
* Remove unnecessary assert in ICMP analyzer which could lead to
|
||||
aborts. Addresses #822.
|
||||
|
||||
* Improve script debugger backtrace and print commands. (Jon Siwek)
|
||||
|
||||
* Switching default DS compression to gzip. (Robin Sommer)
|
||||
|
||||
* Improve availability of IPv6 flow label in connection records.
|
||||
This adds a "flow_label" field to the "endpoint" record type,
|
||||
which is used for both the "orig" and "resp" fields of
|
||||
"connection" records. The new "connection_flow_label_changed"
|
||||
event also allows tracking of changes in flow labels: it's raised
|
||||
each time one direction of the connection starts using a different
|
||||
label. (Jon Siwek)
|
||||
|
||||
* Add unit tests for Broccoli SSL and Broccoli IPv6 connectivity.
|
||||
(Jon Siwek)
|
||||
|
||||
* Remove AI_ADDRCONFIG getaddrinfo hints flag for listening sockets.
|
||||
(Jon Siwek)
|
||||
|
||||
* Undo unnecessary communication protocol version bump. (Jon Siwek)
|
||||
|
||||
* Add support to Bro for connecting with peers over IPv6. (Jon Siwek)
|
||||
|
||||
- Communication::listen_ipv6 needs to be redef'd to true in order
|
||||
for IPv6 listening sockets to be opened.
|
||||
|
||||
- Added Communication::listen_retry option as an interval at which
|
||||
to retry binding to socket addresses that were already in use.
|
||||
|
||||
- Added some explicit baselines to check in the istate.events and
|
||||
istate.events-ssl tests -- the SSL test was incorrectly passing
|
||||
because it compared two empty files. (The files being empty
|
||||
because "http/base" was given as an argument to Bro which it
|
||||
couldn't handle because that script doesn't exist anymore).
|
||||
|
||||
- Support for communication over non-global IPv6 addresses. This
|
||||
usually requires specifying an additional zone identifier (see
|
||||
RFC 4007). The connect() and listen() BIFs have been changed to
|
||||
accept this zone identifier as an argument.
|
||||
|
||||
|
||||
2.0-377 | 2012-05-24 16:46:06 -0700
|
||||
|
||||
* Documentation fixes. (Jon Siwek and Daniel Thayer)
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
2.0-377
|
||||
2.0-395
|
||||
|
|
19
src/Debug.cc
19
src/Debug.cc
|
@ -721,7 +721,6 @@ static char* get_prompt(bool reset_counter = false)
|
|||
|
||||
string get_context_description(const Stmt* stmt, const Frame* frame)
|
||||
{
|
||||
char buf[1024];
|
||||
ODesc d;
|
||||
const BroFunc* func = frame->GetFunction();
|
||||
|
||||
|
@ -739,10 +738,14 @@ string get_context_description(const Stmt* stmt, const Frame* frame)
|
|||
loc.last_line = 0;
|
||||
}
|
||||
|
||||
safe_snprintf(buf, sizeof(buf), "In %s at %s:%d",
|
||||
size_t buf_size = strlen(d.Description()) + strlen(loc.filename) + 1024;
|
||||
char* buf = new char[buf_size];
|
||||
safe_snprintf(buf, buf_size, "In %s at %s:%d",
|
||||
d.Description(), loc.filename, loc.last_line);
|
||||
|
||||
return string(buf);
|
||||
string retval(buf);
|
||||
delete [] buf;
|
||||
return retval;
|
||||
}
|
||||
|
||||
int dbg_handle_debug_input()
|
||||
|
@ -924,6 +927,8 @@ bool post_execute_stmt(Stmt* stmt, Frame* f, Val* result, stmt_flow_type* flow)
|
|||
// Evaluates the given expression in the context of the currently selected
|
||||
// frame. Returns the resulting value, or nil if none (or there was an error).
|
||||
Expr* g_curr_debug_expr = 0;
|
||||
const char* g_curr_debug_error = 0;
|
||||
bool in_debug = false;
|
||||
|
||||
// ### fix this hardwired access to external variables etc.
|
||||
struct yy_buffer_state;
|
||||
|
@ -969,6 +974,11 @@ Val* dbg_eval_expr(const char* expr)
|
|||
Val* result = 0;
|
||||
if ( yyparse() )
|
||||
{
|
||||
if ( g_curr_debug_error )
|
||||
debug_msg("Parsing expression '%s' failed: %s\n", expr, g_curr_debug_error);
|
||||
else
|
||||
debug_msg("Parsing expression '%s' failed\n", expr);
|
||||
|
||||
if ( g_curr_debug_expr )
|
||||
{
|
||||
delete g_curr_debug_expr;
|
||||
|
@ -983,6 +993,9 @@ Val* dbg_eval_expr(const char* expr)
|
|||
|
||||
delete g_curr_debug_expr;
|
||||
g_curr_debug_expr = 0;
|
||||
delete [] g_curr_debug_error;
|
||||
g_curr_debug_error = 0;
|
||||
in_debug = false;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -553,6 +553,7 @@ int dbg_cmd_print(DebugCmd cmd, const vector<string>& args)
|
|||
for ( int i = 0; i < int(args.size()); ++i )
|
||||
{
|
||||
expr += args[i];
|
||||
if ( i < int(args.size()) - 1 )
|
||||
expr += " ";
|
||||
}
|
||||
|
||||
|
@ -566,8 +567,7 @@ int dbg_cmd_print(DebugCmd cmd, const vector<string>& args)
|
|||
}
|
||||
else
|
||||
{
|
||||
// ### Print something?
|
||||
// debug_msg("<expression has no value>\n");
|
||||
debug_msg("<expression has no value>\n");
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -49,9 +49,7 @@ void ICMP_Analyzer::DeliverPacket(int len, const u_char* data,
|
|||
|
||||
const struct icmp* icmpp = (const struct icmp*) data;
|
||||
|
||||
assert(caplen >= len); // Should have been caught earlier already.
|
||||
|
||||
if ( ! ignore_checksums )
|
||||
if ( ! ignore_checksums && caplen >= len )
|
||||
{
|
||||
int chksum = 0;
|
||||
|
||||
|
|
|
@ -112,13 +112,14 @@ bool is_export = false; // true if in an export {} block
|
|||
* (obviously not reentrant).
|
||||
*/
|
||||
extern Expr* g_curr_debug_expr;
|
||||
extern bool in_debug;
|
||||
extern const char* g_curr_debug_error;
|
||||
|
||||
#define YYLTYPE yyltype
|
||||
|
||||
Expr* bro_this = 0;
|
||||
int in_init = 0;
|
||||
int in_record = 0;
|
||||
bool in_debug = false;
|
||||
bool resolving_global_ID = false;
|
||||
bool defining_global_ID = false;
|
||||
|
||||
|
@ -249,7 +250,6 @@ bro:
|
|||
TOK_DEBUG { in_debug = true; } expr
|
||||
{
|
||||
g_curr_debug_expr = $3;
|
||||
in_debug = false;
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -1685,6 +1685,9 @@ int yyerror(const char msg[])
|
|||
strcat(msgbuf, "\nDocumentation mode is enabled: "
|
||||
"remember to check syntax of ## style comments\n");
|
||||
|
||||
if ( in_debug )
|
||||
g_curr_debug_error = copy_string(msg);
|
||||
|
||||
reporter->Error("%s", msgbuf);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -22,3 +22,11 @@
|
|||
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p name addl notice peer
|
||||
#types time string addr port addr port string string bool string
|
||||
1334094648.590126 - - - - - truncated_IP - F bro
|
||||
#separator \x09
|
||||
#set_separator ,
|
||||
#empty_field (empty)
|
||||
#unset_field -
|
||||
#path weird
|
||||
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p name addl notice peer
|
||||
#types time string addr port addr port string string bool string
|
||||
1338328954.078361 - - - - - internally_truncated_header - F bro
|
||||
|
|
BIN
testing/btest/Traces/trunc/icmp-header-trunc.pcap
Normal file
BIN
testing/btest/Traces/trunc/icmp-header-trunc.pcap
Normal file
Binary file not shown.
BIN
testing/btest/Traces/trunc/icmp-payload-trunc.pcap
Normal file
BIN
testing/btest/Traces/trunc/icmp-payload-trunc.pcap
Normal file
Binary file not shown.
|
@ -6,4 +6,17 @@
|
|||
# @TEST-EXEC: cat weird.log >> output
|
||||
# @TEST-EXEC: bro -r $TRACES/trunc/ip6-ext-trunc.pcap
|
||||
# @TEST-EXEC: cat weird.log >> output
|
||||
|
||||
# If an ICMP packet's payload is truncated due to too small snaplen,
|
||||
# the checksum calculation is bypassed (and Bro doesn't crash, of course).
|
||||
|
||||
# @TEST-EXEC: rm -f weird.log
|
||||
# @TEST-EXEC: bro -r $TRACES/trunc/icmp-payload-trunc.pcap
|
||||
# @TEST-EXEC: test ! -e weird.log
|
||||
|
||||
# If an ICMP packet has the ICMP header truncated due to too small snaplen,
|
||||
# an internally_truncated_header weird gets generated.
|
||||
|
||||
# @TEST-EXEC: bro -r $TRACES/trunc/icmp-header-trunc.pcap
|
||||
# @TEST-EXEC: cat weird.log >> output
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue