diff --git a/CHANGES b/CHANGES index 7303686c55..57525ad3da 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,30 @@ +2.6-beta2-14 | 2018-09-25 16:38:29 -0500 + + * Add some missing @TEST-REQUIRES to a few tests (Daniel Thayer) + +2.6-beta2-12 | 2018-09-24 10:56:09 -0500 + + * Fix BasicThread::SetOSName on FreeBSD (Dominik Charousset) + +2.6-beta2-10 | 2018-09-21 13:29:15 -0500 + + * Fix some broken @TEST-REQUIRES in unit tests (Daniel Thayer) + +2.6-beta2-8 | 2018-09-21 13:25:50 -0500 + + * Emit missing GeoIP database errors only once at startup (Jon Siwek, Corelight) + +2.6-beta2-7 | 2018-09-21 10:18:55 -0500 + + * Fix compile error in MMDB GeoIP code (Jon Siwek, Corelight) + +2.6-beta2-6 | 2018-09-20 13:15:15 -0500 + + * Add a missing "break" in OSFinger.cc (Daniel Thayer) + + * Fix buffer sizes in the rotate_file function (Daniel Thayer) + 2.6-beta2-3 | 2018-09-19 15:21:00 -0500 * Add HTTP::sqli_policy hook to ignore counting a request as a SQL injection diff --git a/VERSION b/VERSION index 6da25a8a6b..6174f5ca99 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.6-beta2-3 +2.6-beta2-14 diff --git a/src/OSFinger.cc b/src/OSFinger.cc index bcb00e324b..df5f30b0cc 100644 --- a/src/OSFinger.cc +++ b/src/OSFinger.cc @@ -469,6 +469,7 @@ reparse_ptr: { case 'E': Error("OS fingerprinting: Quirk 'E' is obsolete. Remove it, append E to the options. Line",(uint32)ln); + break; case 'K': if ( mode != RST_FINGERPRINT_MODE ) diff --git a/src/bro.bif b/src/bro.bif index b2dd814317..88aaa487d0 100644 --- a/src/bro.bif +++ b/src/bro.bif @@ -3626,7 +3626,7 @@ private: }; MMDB::MMDB(const char* filename, struct stat info) - : file_info{info}, lookup_error{false}, + : file_info(info), lookup_error{false}, last_check{std::chrono::steady_clock::now()} { int status = MMDB_open(filename, MMDB_MODE_MMAP, &mmdb); @@ -3695,6 +3695,8 @@ const char* MMDB::Filename() std::unique_ptr mmdb_loc; std::unique_ptr mmdb_asn; +static bool did_mmdb_loc_db_error = false; +static bool did_mmdb_asn_db_error = false; static bool mmdb_open(const char* filename, bool asn) { @@ -3719,6 +3721,11 @@ static bool mmdb_open(const char* filename, bool asn) catch ( const std::exception& e ) { + if ( asn ) + did_mmdb_asn_db_error = false; + else + did_mmdb_loc_db_error = false; + reporter->Info("Failed to open MaxMind DB: %s [%s]", filename, e.what()); return false; @@ -3742,6 +3749,7 @@ static void mmdb_check_loc() if ( mmdb_loc && mmdb_loc->StaleDB() ) { reporter->Info("Closing stale MaxMind DB [%s]", mmdb_loc->Filename()); + did_mmdb_loc_db_error = false; mmdb_loc.release(); } } @@ -3751,6 +3759,7 @@ static void mmdb_check_asn() if ( mmdb_asn && mmdb_asn->StaleDB() ) { reporter->Info("Closing stale MaxMind DB [%s]", mmdb_asn->Filename()); + did_mmdb_asn_db_error = false; mmdb_asn.release(); } } @@ -3943,7 +3952,12 @@ function lookup_location%(a: addr%) : geo_location { if ( ! mmdb_try_open_loc() ) { - builtin_error("Failed to open GeoIP location database"); + if ( ! did_mmdb_loc_db_error ) + { + did_mmdb_loc_db_error = true; + builtin_error("Failed to open GeoIP location database"); + } + return location; } } @@ -4021,7 +4035,12 @@ function lookup_asn%(a: addr%) : count { if ( ! mmdb_try_open_asn() ) { - builtin_error("No open GeoIP ASN database"); + if ( ! did_mmdb_asn_db_error ) + { + did_mmdb_asn_db_error = true; + builtin_error("Failed to open GeoIP ASN database"); + } + return new Val(0, TYPE_COUNT); } } diff --git a/src/threading/BasicThread.cc b/src/threading/BasicThread.cc index 3b6f5d6532..f111028475 100644 --- a/src/threading/BasicThread.cc +++ b/src/threading/BasicThread.cc @@ -11,6 +11,10 @@ #include #endif +#ifdef __FreeBSD__ +#include +#endif + using namespace threading; static const int STD_FMT_BUF_LEN = 2048; @@ -60,8 +64,8 @@ void BasicThread::SetOSName(const char* arg_name) pthread_setname_np(arg_name); #endif -#ifdef FREEBSD - pthread_set_name_np(thread.native_handle(), arg_name, arg_name); +#ifdef __FreeBSD__ + pthread_set_name_np(thread.native_handle(), arg_name); #endif } diff --git a/src/util.cc b/src/util.cc index 35db6f131c..a1cd138b1e 100644 --- a/src/util.cc +++ b/src/util.cc @@ -1272,7 +1272,7 @@ FILE* rotate_file(const char* name, RecordVal* rotate_info) // Build file names. const int buflen = strlen(name) + 128; - char tmpname[buflen], newname[buflen+4]; + char newname[buflen], tmpname[buflen+4]; safe_snprintf(newname, buflen, "%s.%d.%.06f.tmp", name, getpid(), network_time); diff --git a/testing/btest/bifs/dump_current_packet.bro b/testing/btest/bifs/dump_current_packet.bro index 0a852037a4..e61c9585cd 100644 --- a/testing/btest/bifs/dump_current_packet.bro +++ b/testing/btest/bifs/dump_current_packet.bro @@ -1,3 +1,4 @@ +# @TEST-REQUIRES: which hexdump # @TEST-EXEC: bro -b -r $TRACES/wikipedia.trace %INPUT # @TEST-EXEC: hexdump -C 1.pcap >1.hex # @TEST-EXEC: hexdump -C 2.pcap >2.hex diff --git a/testing/btest/core/disable-mobile-ipv6.test b/testing/btest/core/disable-mobile-ipv6.test index 5151a12b38..88eb2b853f 100644 --- a/testing/btest/core/disable-mobile-ipv6.test +++ b/testing/btest/core/disable-mobile-ipv6.test @@ -1,4 +1,4 @@ -# @TEST-REQUIRES: grep -q "#undef ENABLE_MOBILE_IPV6" $BUILD/config.h +# @TEST-REQUIRES: grep -q "#undef ENABLE_MOBILE_IPV6" $BUILD/bro-config.h # @TEST-EXEC: bro -r $TRACES/mobile-ipv6/mip6_back.trace %INPUT # @TEST-EXEC: btest-diff weird.log diff --git a/testing/btest/core/mobile-ipv6-home-addr.test b/testing/btest/core/mobile-ipv6-home-addr.test index 536d381f9b..e171a07afb 100644 --- a/testing/btest/core/mobile-ipv6-home-addr.test +++ b/testing/btest/core/mobile-ipv6-home-addr.test @@ -1,4 +1,4 @@ -# @TEST-REQUIRES: grep -q "#define ENABLE_MOBILE_IPV6" $BUILD/config.h +# @TEST-REQUIRES: grep -q "#define ENABLE_MOBILE_IPV6" $BUILD/bro-config.h # @TEST-EXEC: bro -b -r $TRACES/mobile-ipv6/ipv6-mobile-hoa.trace %INPUT >output # @TEST-EXEC: btest-diff output diff --git a/testing/btest/core/mobile-ipv6-routing.test b/testing/btest/core/mobile-ipv6-routing.test index 6ad5be002d..ea99a70706 100644 --- a/testing/btest/core/mobile-ipv6-routing.test +++ b/testing/btest/core/mobile-ipv6-routing.test @@ -1,4 +1,4 @@ -# @TEST-REQUIRES: grep -q "#define ENABLE_MOBILE_IPV6" $BUILD/config.h +# @TEST-REQUIRES: grep -q "#define ENABLE_MOBILE_IPV6" $BUILD/bro-config.h # @TEST-EXEC: bro -b -r $TRACES/mobile-ipv6/ipv6-mobile-routing.trace %INPUT >output # @TEST-EXEC: btest-diff output diff --git a/testing/btest/core/mobility-checksums.test b/testing/btest/core/mobility-checksums.test index 8a88eb8194..42877b63d4 100644 --- a/testing/btest/core/mobility-checksums.test +++ b/testing/btest/core/mobility-checksums.test @@ -1,4 +1,4 @@ -# @TEST-REQUIRES: grep -q "#define ENABLE_MOBILE_IPV6" $BUILD/config.h +# @TEST-REQUIRES: grep -q "#define ENABLE_MOBILE_IPV6" $BUILD/bro-config.h # @TEST-EXEC: bro -r $TRACES/chksums/mip6-bad-mh-chksum.pcap # @TEST-EXEC: mv weird.log bad.out # @TEST-EXEC: bro -r $TRACES/chksums/ip6-hoa-tcp-bad-chksum.pcap diff --git a/testing/btest/core/mobility_msg.test b/testing/btest/core/mobility_msg.test index 73461e7944..1fde084dc2 100644 --- a/testing/btest/core/mobility_msg.test +++ b/testing/btest/core/mobility_msg.test @@ -1,4 +1,4 @@ -# @TEST-REQUIRES: grep -q "#define ENABLE_MOBILE_IPV6" $BUILD/config.h +# @TEST-REQUIRES: grep -q "#define ENABLE_MOBILE_IPV6" $BUILD/bro-config.h # @TEST-EXEC: bro -b -r $TRACES/mobile-ipv6/mip6_back.trace %INPUT >output # @TEST-EXEC: bro -b -r $TRACES/mobile-ipv6/mip6_be.trace %INPUT >>output # @TEST-EXEC: bro -b -r $TRACES/mobile-ipv6/mip6_brr.trace %INPUT >>output diff --git a/testing/btest/core/pcap/dumper.bro b/testing/btest/core/pcap/dumper.bro index 8f89987b37..0f2bdb072e 100644 --- a/testing/btest/core/pcap/dumper.bro +++ b/testing/btest/core/pcap/dumper.bro @@ -1,3 +1,4 @@ +# @TEST-REQUIRES: which hexdump # @TEST-EXEC: bro -r $TRACES/workshop_2011_browse.trace -w dump # @TEST-EXEC: hexdump -C $TRACES/workshop_2011_browse.trace >1 # @TEST-EXEC: hexdump -C dump >2 diff --git a/testing/btest/coverage/find-bro-logs.test b/testing/btest/coverage/find-bro-logs.test index 4e54b1071a..e7bcf0578f 100644 --- a/testing/btest/coverage/find-bro-logs.test +++ b/testing/btest/coverage/find-bro-logs.test @@ -4,6 +4,7 @@ # # If this test fails, then the "Log Files" documentation page should be updated. +# @TEST-REQUIRES: which python # @TEST-EXEC: bash %INPUT # @TEST-EXEC: btest-diff out