[Bro] Clarification needed

Seth Hall seth at icir.org
Fri Sep 19 13:19:53 PDT 2014


On Sep 19, 2014, at 3:43 PM, PeLo <phrackmod at gmail.com> wrote:

> 	### Error occurs here
> 	### Error Output
> 	### ============
> 	### error : type clash (addr and {74.125.236.213,2404:6800:4007:803::1015})
> 	### error : type mismatch ({74.125.236.213,2404:6800:4007:803::1015} and addr)
> 	
> 	local google_ips: set[addr] = { mail.google.com, maps.google.com, youtube.com };
> 	for (i in google_ips)	print(i);

Ugh, I suspect this has something to do with using the "{ }" constructor syntax somewhere that it shouldn't be used.  I.e., you've encountered a wart.

> 	### No errors and output here
> 	### Anything wrong with the code??? 

You have an issue where you are trying to synchronously access data from asynchronous operations. :)

When statements return immediately and the body only executes after the condition becomes true.  You are printing before you've actually gotten a response from the DNS server.  Let me try restructuring your code a bit...

	http://try.bro.org/#/trybro/saved/89b6a856-c785-4cea-bfc3-206947bc054a

Does that explain it a bit better?

  .Seth

--
Seth Hall
International Computer Science Institute
(Bro) because everyone has a network
http://www.bro.org/





More information about the Bro mailing list