DDNS in firewall

It resolves a DDNS address and puts the result in a firewall filter.
I use it to grant access to my company’s MikroTik from my home network with a dynamic WAN IP.
Maybe you have any ideas to improve it?

The FW:

/ip firewall filter add chain=input action=accept src-address=1.2.3.4 comment=myFireWall

The script:

{
:local myIP [resolve xxxxxxxxxxxxxx.sn.mynetname.net]
/ip firewall filter 
:local myFW [find where comment=myFireWall]
set src-address=$myIP number=$myFW
}

With recent-enough RouterOS, you can do:

/ip firewall address-list
add address=xxxxxxxxxxxxxx.sn.mynetname.net list=myIP
/ip firewall filter
add chain=input action=accept src-address-list=myIP

Ooook. So my script is useless. :smiley:
Thanx, your solution works great.