Anyone that can help me out why this does not work ?
Basically I combined some posting in order to make a script that should work, but it only cleans/empties my "DNS" address-list.
I've download the link below containing a bunch of DOH/DOT public servers that I want to convert into an ACL.
https://github.com/oneoffdallas/dohserv ... iplist.txt
Basically I took the (non-working on RouterOS 6.x) script from the WIKI and added the correction that is suggested to make it work again in this post.
But still, list remains empty basically.
The "iplist.txt" contains some line starting with # which should be ignored.
It also contains some "blank" lines, I wonder if that is ok.
Below a small piece of the list.
-----------------
# DNS over HTTPS (DoH) server IP list
# This is a list of IPs which correspond to publicly available DoH providers
# It can be used to firewall these IP addresses
# This list was generated by running `dig +short HOSTNAME A`
# Twitter: @oneoffdallas
# Homepage:
https://github.com/oneoffdallas/dohservers
# Raw data:
https://raw.githubusercontent.com/oneof ... iplist.txt
#
# Added: 14 Oct 2019
# Last modified: 05 Apr 2021
# Optionally include Cloudflare's main addresses (Google and Quad9 included below)
# 1.1.1.1
# 1.0.0.1
#
# security.cloudflare-dns.com - see IPs further down this list
# 1.1.1.2
# 1.0.0.2
#
# family.cloudflare-dns.com
# 1.1.1.3
# 1.0.0.3
# dns.cloudflare.com
# (optional because cdnjs.cloudflare.com uses the same IPs)
# 104.16.132.229
# 104.16.133.229
# NOTES
# Quad9 is also using Port 5053 for DoH: (last checked 11 Jan 2020)
#
https://www.quad9.net/doh-quad9-dns-ser ... nformation
#
# dnscrypt.ca is using Port 453 for DoH (instead of 443)
168.235.81.167
176.56.236.175
176.103.130.131
176.103.130.130
176.103.130.132
176.103.130.134
37.252.185.229
206.189.215.75
-------------------------------
So the script itself :
## Generic IP address list input
## Based on a script written by Sam Norris, ChangeIP.com 2008
## Edited by Andrew Cox, AccessPlus.com.au 2008
:if ( [/file get [/file find name=iplist.txt] size] > 0 ) do={
# Remove exisiting addresses from the current Address list
/ip firewall address-list remove [/ip firewall address-list find list=DNS]
:global content [/file get [/file find name=iplist.txt] contents] ;
:global contentLen [ :len $content ] ;
:global lineEnd 0;
:global line "";
:global lastEnd 0;
:while ($lineEnd < $contentLen) do={
:set lineEnd [:find $content "\n" $lastEnd ] ;
:set line [:pick $content $lastEnd $lineEnd] ;
:set lastEnd ( $lineEnd + 1 ) ;
#If the line doesn't start with a hash then process and add to the list
:if ( [:pick $line 0 1] != "#" ) do={
:local entry [:pick $line 0 $lineEnd ]
:if ( [:len $entry ] > 0 ) do={
/ip firewall address-list add list="DNS"
}
}
}
}