netwatch-notify: check matching address type only

This commit is contained in:
Christian Hesse 2025-03-12 11:26:22 +01:00
parent 1555426687
commit b63e0fcb2f

View file

@ -61,15 +61,19 @@
:global GetRandom20CharAlNum; :global GetRandom20CharAlNum;
:local FwAddrList ($ScriptName . "-" . [ $GetRandom20CharAlNum ]); :local FwAddrList ($ScriptName . "-" . [ $GetRandom20CharAlNum ]);
/ip/firewall/address-list/add address=$Name list=$FwAddrList dynamic=yes timeout=10s; :if ([ :typeof [ :toip $Expected ] ] = "ip") do={
:delay 20ms; /ip/firewall/address-list/add address=$Name list=$FwAddrList dynamic=yes timeout=10s;
:if ([ :len [ /ip/firewall/address-list/find where list=$FwAddrList address=$Expected ] ] > 0) do={ :delay 20ms;
:return true; :if ([ :len [ /ip/firewall/address-list/find where list=$FwAddrList address=$Expected ] ] > 0) do={
:return true;
}
} }
/ipv6/firewall/address-list/add address=$Name list=$FwAddrList dynamic=yes timeout=10s; :if ([ :typeof [ :toip6 $Expected ] ] = "ip6") do={
:delay 20ms; /ipv6/firewall/address-list/add address=$Name list=$FwAddrList dynamic=yes timeout=10s;
:if ([ :len [ /ipv6/firewall/address-list/find where list=$FwAddrList address=$Expected ] ] > 0) do={ :delay 20ms;
:return true; :if ([ :len [ /ipv6/firewall/address-list/find where list=$FwAddrList address=$Expected ] ] > 0) do={
:return true;
}
} }
:return false; :return false;