diff --git a/CHANGES b/CHANGES index b9f9b4c082..429184c9fd 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,16 @@ +2.0-608 | 2012-06-11 15:59:00 -0700 + + * Add more error handling code to logging of enum vals. Addresses + #829. (Jon Siwek) + +2.0-606 | 2012-06-11 15:55:56 -0700 + + * Fix summary lines for BIF documentation and corrected the + description of "fmt" and "floor" BIFs. (Daniel Thayer) + + * Fix val_size BIF tests and improve docs. (Daniel Thayer) + 2.0-602 | 2012-06-07 15:06:19 -0700 * Include header for usleep(), caused compile failure on Archlinux. (Jon Siwek) diff --git a/VERSION b/VERSION index 69a4ae2e69..c6723b4d6c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0-602 +2.0-608 diff --git a/aux/binpac b/aux/binpac index b4094cb75e..6f43a8115d 160000 --- a/aux/binpac +++ b/aux/binpac @@ -1 +1 @@ -Subproject commit b4094cb75e0a7769123f7db1f5d73f3f9f1c3977 +Subproject commit 6f43a8115d8e6483a50957c5d21c5d69270ab3aa diff --git a/aux/bro-aux b/aux/bro-aux index f938c81ada..c6391412e9 160000 --- a/aux/bro-aux +++ b/aux/bro-aux @@ -1 +1 @@ -Subproject commit f938c81ada94641ab5f0231983edc2ba866b9a1f +Subproject commit c6391412e902e896836450ab98910309b2ca2d9b diff --git a/aux/broccoli b/aux/broccoli index 4e17842743..0d139c09d5 160000 --- a/aux/broccoli +++ b/aux/broccoli @@ -1 +1 @@ -Subproject commit 4e17842743fef8df6abf0588c7ca86c6937a2b6d +Subproject commit 0d139c09d5a9c8623ecc2a5f395178f0ddcd7e16 diff --git a/aux/broctl b/aux/broctl index 589cb04c3d..880f3e48d3 160000 --- a/aux/broctl +++ b/aux/broctl @@ -1 +1 @@ -Subproject commit 589cb04c3d7e28a81aa07454e2b9b6b092f0e1af +Subproject commit 880f3e48d33bb28d17184656f858a4a0e2e1574c diff --git a/cmake b/cmake index 96f3d92aca..2a72c5e08e 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 96f3d92acadbe1ae64f410e974c5ff503903394b +Subproject commit 2a72c5e08e018cf632033af3920432d5f684e130 diff --git a/src/bro.bif b/src/bro.bif index b49c88058a..1feccb8639 100644 --- a/src/bro.bif +++ b/src/bro.bif @@ -1494,6 +1494,8 @@ function sort%(v: any, ...%) : any ## v: The vector whose order to compute. ## ## Returns: A ``vector of count`` with the indices of the ordered elements. +## For example, the elements of *v* in order are (assuming ``o`` +## is the vector returned by ``order``): v[o[0]], v[o[1]], etc. ## ## .. bro:see:: sort function order%(v: any, ...%) : index_vec @@ -1669,9 +1671,10 @@ function cat_sep%(sep: string, def: string, ...%): string ## ## - ``[efg]``: Double ## -## Returns: Returns the formatted string. Given no arguments, :bro:id:`fmt`. Given -## no format string or the wrong number of additional arguments for the -## given format specifier, :bro:id:`fmt` generates a run-time error. +## Returns: Returns the formatted string. Given no arguments, :bro:id:`fmt` +## returns an empty string. Given no format string or the wrong +## number of additional arguments for the given format specifier, +## :bro:id:`fmt` generates a run-time error. ## ## .. bro:see:: cat cat_sep string_cat cat_string_array cat_string_array_n function fmt%(...%): string @@ -1715,8 +1718,9 @@ function fmt%(...%): string # # =========================================================================== -## Chops off any decimal digits of the given double, i.e., computes the -## "floor" of it. For example, ``floor(3.14)`` returns ``3.0``. +## Computes the greatest integer less than the given :bro:type:`double` value. +## For example, ``floor(3.14)`` returns ``3.0``, and ``floor(-3.14)`` +## returns ``-4.0``. ## ## d: The :bro:type:`double` to manipulate. ## @@ -1895,8 +1899,9 @@ function reading_traces%(%): bool return new Val(reading_traces, TYPE_BOOL); %} -## Returns statistics about the number of packets *(i)* received by Bro, -## *(ii)* dropped, and *(iii)* seen on the link (not always available). +## Returns packet capture statistics. Statistics include the number of +## packets *(i)* received by Bro, *(ii)* dropped, and *(iii)* seen on the +## link (not always available). ## ## Returns: A record of packet statistics. ## @@ -1930,9 +1935,9 @@ function net_stats%(%): NetStats return ns; %} -## Returns Bro process statistics, such as real/user/sys CPU time, memory -## usage, page faults, number of TCP/UDP/ICMP connections, timers, and events -## queued/dispatched. +## Returns Bro process statistics. Statistics include real/user/sys CPU time, +## memory usage, page faults, number of TCP/UDP/ICMP connections, timers, +## and events queued/dispatched. ## ## Returns: A record with resource usage statistics. ## @@ -2007,10 +2012,10 @@ function resource_usage%(%): bro_resources return res; %} -## Returns statistics about the regular expression engine, such as the number -## of distinct matchers, DFA states, DFA state transitions, memory usage of -## DFA states, cache hits/misses, and average number of NFA states across all -## matchers. +## Returns statistics about the regular expression engine. Statistics include +## the number of distinct matchers, DFA states, DFA state transitions, memory +## usage of DFA states, cache hits/misses, and average number of NFA states +## across all matchers. ## ## Returns: A record with matcher statistics. ## @@ -2190,10 +2195,10 @@ function record_fields%(rec: any%): record_field_table return fields; %} -## Enables detailed collections of statistics about CPU/memory usage, -## connections, TCP states/reassembler, DNS lookups, timers, and script-level -## state. The script variable :bro:id:`profiling_file` holds the name of the -## file. +## Enables detailed collection of profiling statistics. Statistics include +## CPU/memory usage, connections, TCP states/reassembler, DNS lookups, +## timers, and script-level state. The script variable :bro:id:`profiling_file` +## holds the name of the file. ## ## .. bro:see:: net_stats ## resource_usage @@ -2617,7 +2622,7 @@ function count_to_v4_addr%(ip: count%): addr return new AddrVal(htonl(uint32(ip))); %} -## Converts a :bro:type:`string` of bytes into an IP address. In particular, +## Converts a :bro:type:`string` of bytes into an IPv4 address. In particular, ## this function interprets the first 4 bytes of the string as an IPv4 address ## in network order. ## @@ -3016,8 +3021,8 @@ function decode_netbios_name_type%(name: string%): count return new Val(return_val, TYPE_COUNT); %} -## Converts a string of bytes into its hexadecimal representation, e.g., -## ``"04"`` to ``"3034"``. +## Converts a string of bytes into its hexadecimal representation. +## For example, ``"04"`` would be converted to ``"3034"``. ## ## bytestring: The string of bytes. ## @@ -3279,7 +3284,7 @@ function mask_addr%(a: addr, top_bits_to_keep: count%): subnet return new SubNetVal(a->AsAddr(), top_bits_to_keep); %} -## Takes some top bits (e.g., subnet address) from one address and the other +## Takes some top bits (such as a subnet address) from one address and the other ## bits (intra-subnet part) from a second address and merges them to get a new ## address. This is useful for anonymizing at subnet level while preserving ## serial scans. @@ -3516,7 +3521,7 @@ function skip_http_entity_data%(c: connection, is_orig: bool%): any return 0; %} -## Unescapes all characters in a URI, i.e., decodes every ``%xx`` group. +## Unescapes all characters in a URI (decode every ``%xx`` group). ## ## URI: The URI to unescape. ## diff --git a/src/logging/Manager.cc b/src/logging/Manager.cc index 32cea88b9b..7d5190813b 100644 --- a/src/logging/Manager.cc +++ b/src/logging/Manager.cc @@ -828,7 +828,13 @@ threading::Value* Manager::ValToLogVal(Val* val, BroType* ty) const char* s = val->Type()->AsEnumType()->Lookup(val->InternalInt()); - lval->val.string_val = new string(s); + if ( s ) + lval->val.string_val = new string(s); + else + { + val->Type()->Error("enum type does not contain value", val); + lval->val.string_val = new string(); + } break; } diff --git a/testing/btest/Baseline/bifs.val_size/out b/testing/btest/Baseline/bifs.val_size/out deleted file mode 100644 index 16b548f269..0000000000 --- a/testing/btest/Baseline/bifs.val_size/out +++ /dev/null @@ -1,2 +0,0 @@ -72 -72 diff --git a/testing/btest/bifs/order.bro b/testing/btest/bifs/order.bro index 5f3260ee3f..333a8acac1 100644 --- a/testing/btest/bifs/order.bro +++ b/testing/btest/bifs/order.bro @@ -22,8 +22,7 @@ function myfunc2(a: double, b: double): int event bro_init() { - # TODO: these results don't make sense - + # Tests without supplying a comparison function local a1 = vector( 5, 2, 8, 3 ); diff --git a/testing/btest/bifs/val_size.bro b/testing/btest/bifs/val_size.bro index b779460b9b..5b2e535c5c 100644 --- a/testing/btest/bifs/val_size.bro +++ b/testing/btest/bifs/val_size.bro @@ -1,12 +1,16 @@ # -# @TEST-EXEC: bro %INPUT > out -# @TEST-EXEC: btest-diff out +# @TEST-EXEC: bro %INPUT event bro_init() { - local a = 1; - local b = T; + local a = T; + local b = 12; + local c: table[string] of addr = { ["a"] = 192.168.0.2, ["b"] = 10.0.0.2 }; + + if ( val_size(a) > val_size(b) ) + exit(1); + + if ( val_size(b) > val_size(c) ) + exit(1); - print val_size(a); - print val_size(b); }