Merge remote-tracking branch 'origin/master' into dev/2.7

This commit is contained in:
Jon Siwek 2018-09-25 16:47:01 -05:00
commit 43aab5be7b
14 changed files with 65 additions and 12 deletions

26
CHANGES
View file

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

View file

@ -1 +1 @@
2.6-beta2-3
2.6-beta2-14

View file

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

View file

@ -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> mmdb_loc;
std::unique_ptr<MMDB> 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() )
{
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);
}
}

View file

@ -11,6 +11,10 @@
#include <sys/prctl.h>
#endif
#ifdef __FreeBSD__
#include <pthread_np.h>
#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
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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