type checking inconsistencies

Description

If you try to compare a count to a port directly, you get the following:

but if you have a record, and mixup the types like so, it silently fails:

Environment

None

Activity

Show:
Jon Siwek
March 21, 2014, 3:03 PM

topic/jsiwek/improve-type-checks improves the type checking for records and fixes a problem with named table constructors in local scope. I didn't end up removing list expansion of table/set indices.

Jon Siwek
March 20, 2014, 9:27 PM

Also, where are things today with supporting constructs like

where badguy.foo.com might resolve to multiple addresses? That was another reason why Bro has support for list-based expansion in initializers.

It should still work – the lookup happens while parsing.

And yeah, it still relies on the list expansion in the initializer to work, but I'm probably going to try and pass on removing the list-based expansion stuff at least as part of this ticket.

Vern Paxson
March 20, 2014, 7:17 PM

Runtime as a general style for this sounds fine, but I'd still like to know whether it works at compile-time like it used to. It's also not clear to me that at run-time one will always know when it's necessary to look up a name (for which there may be zillions) on the off chance that it has changed.

Seth Hall
March 20, 2014, 7:04 PM

I actually avoid the parse time name resolution and tend toward runtime lookups with the dns bifs going on the assumption that Bro is an extremely long lived process and I’d rather not rely on a name lookup that happened a (potentially) long time ago.

Vern Paxson
March 20, 2014, 6:25 PM

I'm okay with removing it, too. FYI, I don't regret having it there initially, though. Back when Bro's analysis was heavier on firewall-type rules, this was a good way to keep rules concise and thus less likely to be buggy. (And I can imagine introducing a cleaner language construct to still provide this sort of compactness in the future …. if we find plausible use cases for modern scripts.)

Also, where are things today with supporting constructs like

where badguy.foo.com might resolve to multiple addresses? That was another reason why Bro has support for list-based expansion in initializers.

Merged

Assignee

Jon Siwek

Reporter

Justin Azoff

Labels

External issue ID

None

Components

Affects versions

Priority

Low