Backup config to Gmail v1.7

Yeah it not only “:export XXXX-sensitive” attributes that differ subtle ways. I’ve been using V7 as excuse to re-writing my V6 scripts as functions, which has worked out well so far: basically everything is a parameterized function. So if you combine [:parse] WITH a function to apply @rextended’s route table fix in above post…


:global rosmajorver [:tonum [:pick [/system resource get version] 0 1]]
:global rtlookup
:set $rtlookup do={
    :if ($rosmajorver>6) do={
        :return [[:parse "/routing table find where name=$1"]]
    } else={
        :return $1
    }
}

# >>  :put [$rtlookup main]
#    *0

With that above your firewall script, like so:

/ip firewall nat find where routing-mark=[$rtlookup "main"]

The function will hide the “ugly” :parse, and in theory you can use extend the above function to validate the route table for V6 etc. But using functions is how I’ve generically solve any some of oddities without a lot of “:if () do={}”'s everywhere.

Note: I know the code works for “main”, but didn’t test too much – more example of an approach to the next “show-sensitive”.