diff --git a/CHANGES b/CHANGES index b240ad7772..be817f00c4 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,11 @@ +2.1-58 | 2012-10-08 10:10:09 -0700 + + * Fix a problem with non-manager cluster nodes applying + Notice::policy. This could, for example, result in duplicate + emails being sent if Notice::emailed_types is redef'd in local.bro + (or any script that gets loaded on all cluster nodes). (Jon Siwek) + 2.1-56 | 2012-10-03 16:04:52 -0700 * Add general FAQ entry about upgrading Bro. (Jon Siwek) diff --git a/VERSION b/VERSION index 72d5fb372d..9dc6ee4e74 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.1-56 +2.1-58 diff --git a/scripts/base/frameworks/notice/cluster.bro b/scripts/base/frameworks/notice/cluster.bro index 087c3ead51..3ee113acf3 100644 --- a/scripts/base/frameworks/notice/cluster.bro +++ b/scripts/base/frameworks/notice/cluster.bro @@ -23,7 +23,7 @@ redef Cluster::worker2manager_events += /Notice::cluster_notice/; @if ( Cluster::local_node_type() != Cluster::MANAGER ) # The notice policy is completely handled by the manager and shouldn't be # done by workers or proxies to save time for packet processing. -event bro_init() &priority=-11 +event bro_init() &priority=11 { Notice::policy = table(); } diff --git a/src/input/Manager.cc b/src/input/Manager.cc index 83e9dc9bc5..df06af7454 100644 --- a/src/input/Manager.cc +++ b/src/input/Manager.cc @@ -320,22 +320,12 @@ bool Manager::CreateStream(Stream* info, RecordVal* description) } Unref(mode); - + Val* config = description->LookupWithDefault(rtype->FieldOffset("config")); - - ReaderFrontend* reader_obj = new ReaderFrontend(*rinfo, reader); - assert(reader_obj); - - info->reader = reader_obj; - info->type = reader->AsEnumVal(); // ref'd by lookupwithdefault - info->name = name; info->config = config->AsTableVal(); // ref'd by LookupWithDefault - info->info = rinfo; - - Ref(description); - info->description = description; - + { + // create config mapping in ReaderInfo. Has to be done before the construction of reader_obj. HashKey* k; IterCookie* c = info->config->AsTable()->InitForIteration(); @@ -345,13 +335,27 @@ bool Manager::CreateStream(Stream* info, RecordVal* description) ListVal* index = info->config->RecoverIndex(k); string key = index->Index(0)->AsString()->CheckString(); string value = v->Value()->AsString()->CheckString(); - info->info->config.insert(std::make_pair(copy_string(key.c_str()), copy_string(value.c_str()))); + printf("Inserting %s:%s\n", key.c_str(), value.c_str()); + rinfo->config.insert(std::make_pair(copy_string(key.c_str()), copy_string(value.c_str()))); Unref(index); delete k; } } + + ReaderFrontend* reader_obj = new ReaderFrontend(*rinfo, reader); + assert(reader_obj); + + info->reader = reader_obj; + info->type = reader->AsEnumVal(); // ref'd by lookupwithdefault + info->name = name; + info->info = rinfo; + + Ref(description); + info->description = description; + + DBG_LOG(DBG_INPUT, "Successfully created new input stream %s", name.c_str());