[Bro-Dev] #660: Initializing a table with a record as an index does not work

Bro Tracker bro at tracker.bro-ids.org
Wed Nov 2 14:55:28 PDT 2011


#660: Initializing a table with a record as an index does not work
----------------------+-----------------
  Reporter:  amannb   |      Owner:
      Type:  Problem  |     Status:  new
  Priority:  Normal   |  Milestone:
 Component:  Bro      |    Version:
Resolution:           |   Keywords:
----------------------+-----------------

Comment (by robin):

 On Wed, Nov 02, 2011 at 21:15 -0000, you wrote:

 >  Using a record as an index on a table or set is usually not a good
 idea.
 >  Lookups may not happen as you expect if you are using a different
 record
 >  instance to index into the table or set since Bro isn't doing value
 >  equality but actually looking for the same record.

 Are you sure? This works as I would expect it:

 {{{

 type r: record  {
         a: string;
         };

 global foo: table[r] of count;

 global a: r = [$a="foo"];
 global b: r = [$a="foo"];
 global c: r = [$a="bar"];

 foo[a] = 1;

 print a in foo;
 print b in foo;
 print c in foo;


 }}}

-- 
Ticket URL: <http://tracker.bro-ids.org/bro/ticket/660#comment:1>
Bro Tracker <http://tracker.bro-ids.org/bro>
Bro Issue Tracker



More information about the bro-dev mailing list