Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :log info "Start"
- :foreach idx in=[/ip/firewall/address-list/find list=PRIORITY_HOSTS] do={
- :local ip [/ip/firewall/address-list/get $idx address];
- :local tag [/ip/firewall/address-list/get $idx comment];
- :local lease [/ip/dhcp-server/lease/find where address=$ip];
- :local mac [/ip/dhcp-server/lease/get $lease mac-address];
- :foreach n in=[/ipv6/neighbor/find where mac-address=$mac interface=BRIDGE_LAN] do={
- :local candidate [/ipv6/neighbor/get $n address]
- :log info [:serialize value=$candidate to=json]
- :if ([:len $candidate] > 0 && [:pick $candidate 0 4] = "2605") do={
- :log info ("/ipv6/firewall/address-list/print where list=PRIORITY_HOSTS address=" . $candidate);
- # ^^^ IF I RUN THIS COMMAND IT RETURNS A VALID MATCH
- :log info (":put [/ipv6/firewall/address-list/find list=PRIORITY_HOSTS address=" . $candidate . "]");
- # ^^^ IF I RUN THIS COMMAND IT RETURNS A VALID MATCH
- :local existing [/ipv6/firewall/address-list/find list=PRIORITY_HOSTS address=$candidate];
- # ^^^ NEVER POPULATED EVEN THOUGH LIST ENTRY IS 100% VERIFIED TO EXIST AND BOTH PRINT AND FIND COMMANDS 100% RETURN A MATCH MANUALLY
- :if ([:len $existing] = 0) do={
- /ipv6/firewall/address-list/add comment=$tag list=PRIORITY_HOSTS timeout=1:0:0 address=$candidate;
- # ^^^ ALWAYS THROWS ERROR BECAUSE ENTRY EXISTS
- } else={
- /ipv6/firewall/address-list/set $existing timeout=4:0:0;
- # ^^^ NEVER RUN BECAUSE `existing` IS NOT POPULATED
- }
- }
- }
- }
- :log info "End"
Advertisement
Add Comment
Please, Sign In to add comment