[Bro] problem with &expire_func

Christoph Göldi goeldich at ee.ethz.ch
Thu Feb 10 13:20:36 PST 2005


hi vern

> The problem here is that if there's just a single index, it's transmitted
> in the call to the expire_func as its own type rather than as a combo
> "any" type.  So you need to instead use:
> 
> 	function myfunc(t: table[addr] of bool , idx: addr): interval {
> 		local srcIP: addr;
> 		srcIP = idx;
> 		return 0secs;
> 	}
> 
> (Or "local srcIP = idx", or just use idx directly in the function.)
> 
> Bro shouldn't of course crash for the example above as you gave it.
> I've entered fixing this into the bug-tracker, but using the type directly
> as I show is the proper way to do this (i.e., not merely a workaround).


i already tried these cases:

> 	function myfunc(t: table[addr] of bool , idx: addr): interval {
> 		local srcIP: addr;
> 		srcIP = idx;
> 		return 0secs;
> 	}

results in this error when i want to start bro:
> policy/test.bro, line xx (srcIP = idx): error, type clash in assignment

and:
> function myfunc(t: table[addr] of count, idx: any): interval {
>       local srcIP = idx;
> 	print t[srcIP];
>       return 0secs;
> }

results in:
> addr, line 0 and policy/test.bro, line xx
>    (addr and srcIP): error, type clash
> policy/test.bro, line xx and addr, line 0
>    (srcIP and addr): error, type mismatch
> policy/test.bro, line xx (t[srcIP]): error, not an index type

any further ideas?

cheers
christoph



More information about the Bro mailing list