cisagov / icsnpp-bacnet

Zeek BACnet Parser - CISA ICSNPP
BSD 3-Clause "New" or "Revised" License
15 stars 11 forks source link

fix const table declarations with &default for Zeek v5.0.0 #10

Closed mmguero closed 2 years ago

mmguero commented 2 years ago

fixes const table declarations with &default for Zeek v5.0.0

The method of declaring tables that looks like this:

const bvlc_functions = {

Results in this error message in zeek v5.0:

warning in /opt/zeek/lib/zeek/plugins/packages/icsnpp-bacnet/scripts/./consts.zeek, line 627: initialization not preceded by =/+=/-= is deprecated (0 = normal, 1 = fault, 2 = offnormal, 3 = high-limit, 4 = low-limit, 5 = life-safety-alarm)
error in /opt/zeek/lib/zeek/plugins/packages/icsnpp-bacnet/scripts/./consts.zeek, line 633: &default is not valid for global variables except for tables (&default=function(){ return (fmt(Vendor Specific (%d), Bacnet::n))})
expression error in /opt/zeek/lib/zeek/plugins/packages/icsnpp-bacnet/scripts/./consts.zeek, line 627: illegal assignment in initialization (0 = normal)
error in /opt/zeek/lib/zeek/plugins/packages/icsnpp-bacnet/scripts/./consts.zeek, line 626: initialization failed (Bacnet::event_states)

This form works:

const bvlc_functions: table[count] of string = {