[Bro-Dev] [Bro-Commits] [git/bro] master: Merge remote-tracking branch 'origin/fastpath' (d262a70)

Siwek, Jonathan Luke jsiwek at illinois.edu
Fri Jul 27 08:03:42 PDT 2012


Yes, thanks, that tweak makes sense to me:  the loop should also terminate if an autocorrected path is found for which the same filter was previously responsible for writing (probably due to use of a path_func), and still do the warning about the original path conflict.

    Jon

On Jul 26, 2012, at 7:28 PM, Robin Sommer wrote:

> Repository : ssh://git@bro-ids.icir.org/bro
> 
> On branch  : master
> Link       : http://tracker.bro-ids.org/bro/changeset/d262a70509f4f7088c261509d6f6f4b5930f5896/bro
> 
>> ---------------------------------------------------------------
> 
> commit d262a70509f4f7088c261509d6f6f4b5930f5896
> Merge: 412bebb 63e8bf7
> Author: Robin Sommer <robin at icir.org>
> Date:   Thu Jul 26 15:30:35 2012 -0700
> 
>    Merge remote-tracking branch 'origin/fastpath'
> 
>    Small tweak: I added the "same writer" constraint to the loop
>    condition as well. Makes sense?
> 
>    * origin/fastpath:
>      Change path conflicts between log filters to be auto-corrected.
> 
> 
> 
>> ---------------------------------------------------------------
> 
> d262a70509f4f7088c261509d6f6f4b5930f5896
> scripts/base/frameworks/logging/main.bro           |   11 +++++-
> src/logging/Manager.cc                             |   42 +++++++++++++++-----
> .../http-2-2.log}                                  |   21 ++++++++--
> .../http-2.log                                     |   23 +++++++++++
> .../http-3.log                                     |   23 +++++++++++
> .../reporter.log                                   |   17 +-------
> .../frameworks/logging/writer-path-conflict.bro    |   12 +++++-
> 7 files changed, 119 insertions(+), 30 deletions(-)
> 
> diff --cc src/logging/Manager.cc
> index 3499d55,b1b289a..568a777
> --- a/src/logging/Manager.cc
> +++ b/src/logging/Manager.cc
> @@@ -758,9 -758,38 +758,39 @@@ bool Manager::Write(EnumVal* id, Record
>  #endif
>  			}
> 
> + 		Stream::WriterPathPair wpp(filter->writer->AsEnum(), path);
> + 
>  		// See if we already have a writer for this path.
> - 		Stream::WriterMap::iterator w =
> - 			stream->writers.find(Stream::WriterPathPair(filter->writer->AsEnum(), path));
> + 		Stream::WriterMap::iterator w = stream->writers.find(wpp);
> + 
> + 		if ( w != stream->writers.end() &&
> + 		     w->second->instantiating_filter != filter->name )
> + 			{
> + 			// Auto-correct path due to conflict with another filter over the
> + 			// same writer/path pair
> + 			string instantiator = w->second->instantiating_filter;
> + 			string new_path;
> + 			unsigned int i = 2;
> + 
> + 			do {
> + 				char num[32];
> + 				snprintf(num, sizeof(num), "-%u", i++);
> + 				new_path = path + num;
> + 				wpp.second = new_path;
> + 				w = stream->writers.find(wpp);
> -			} while ( w != stream->writers.end());
> ++			} while ( w != stream->writers.end() &&
> ++				  w->second->instantiating_filter != filter->name );
> + 
> + 			Unref(filter->path_val);
> + 			filter->path_val = new StringVal(new_path.c_str());
> + 
> + 			reporter->Warning("Write using filter '%s' on path '%s' changed to"
> + 			  " use new path '%s' to avoid conflict with filter '%s'",
> + 			  filter->name.c_str(), path.c_str(), new_path.c_str(),
> + 			  instantiator.c_str());
> + 
> + 			path = filter->path = filter->path_val->AsString()->CheckString();
> + 			}
> 
>  		WriterFrontend* writer = 0;
> 
> 
> _______________________________________________
> bro-commits mailing list
> bro-commits at bro-ids.org
> http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-commits
> 




More information about the bro-dev mailing list