Ticket #464 (closed Merge Request: fixed)
Bug with complex data structures
| Reported by: | seth | Owned by: | robin |
|---|---|---|---|
| Priority: | High | Milestone: | Bro2.1 |
| Component: | Bro | Version: | |
| Keywords: | Cc: |
Description
This script:
type MetaData: record {
a: count;
tags: set[string];
};
global ip_data: table[addr] of set[MetaData] = table();
local m: MetaData = [$a=4, $tags=set("blah")];
if ( 1.2.3.4 !in ip_data )
ip_data[1.2.3.4] = set(m);
else
add ip_data[1.2.3.4][m];
Results in this error:
1306867820.149493 <no location> and ./test29.bro, line 10
([a=4, tags={blah}] and list of record { a:count; tags:set[string]; }): error, index type doesn't match table
Change History
comment:2 Changed 12 months ago by robin
Turns out records that have more complex fields can't be used as indices for sets.
I think we could add that, but it would be a bit of work. How important is it? Can you use a table[addr] of vector, where the vector then stores the MetaData??
comment:2 Changed 12 months ago by seth
I think we could add that, but it would be a bit of work. How important is
it? Can you use a table[addr] of vector, where the vector then stores the
MetaData??
Ah, I see what you are saying. Yes, I should be able to do that.
comment:3 Changed 12 months ago by seth
I'm actually getting a different error: `1306972010.461281 internal error:
bad index type in CompositeHash::CompositeHash?`
Yeah, I started making some changes in CompHash?.cc and I forgot about it when I filed this ticket. The error you got is the one I meant to use for this ticket.
comment:4 Changed 11 months ago by seth
- Milestone changed from Bro1.6 to Bro1.7
This needs fixed eventually, but it's not critical at the moment. Let's push it back to a later release.
comment:6 Changed 4 months ago by jsiwek
- Type changed from Problem to Merge Request
I believe the changes in topic/jsiwek/complex-record-indices fix this.
I'm actually getting a different error: 1306972010.461281 internal error: bad index type in CompositeHash::CompositeHash