script compatibility

Hi,

I see some changes in v6 break script compatibility from v5. One in particular is the new “/ip firewall connection tracking enable” option that’s gotten a new value of “auto”. Unfortunately this breaks scripts that treat the enabled property as a boolean. It now has to be treated as a string, for example:

# version 5
/ip firewall connection tracking
:if (![get enabled]) do={ :put "connection tracking disabled" }



# version 6
/ip firewall connection tracking
:if ([get enabled] != "yes") do={ :put "connection tracking disabled" }

Version 5 code fatally breaks on version 6, and version 6 code behaves incorrectly on version 5.

Can you come up with a better way of handling this new feature please?

Suggestion:

Add a new boolean property called “auto” and make it default to a value that makes the connection tracker behave as it did in version 5.

This is common, and MT change syntax between releases. IT’s really is a pain in the ass.

I came up with a work around, in case this helps anyone:

/ip firewall connection tracking
:local rosver [:pick [/system resource get version] 0]
:local test
:if ($rosver = "6") do={
  :set test "yes"
} else={
  :set test yes
}
:if ([get enabled] != $test) do={
  set enabled=$test
}

Still mildly annoying. :slight_smile: