Issue
Currently Mikrotik supports only hostfile based blocking. That is OK but not idea, because spammer use also many dyanamic subdomains, that arent blocked automatically.
Currently (I tested it), Mikrotik would load regex based blocking systems, but dont use it for blocking. Regex’es like | or ^ are interpreted as hostname additions, which of example.com^ doesnt exist.
Solution
Loading a DNS Spamlist, in the UI you should be able to select host file based or regex based and then router os can interpret it correct. Regex based spamlist are way more efficient, and would also save memory from the DNS Cache, because many entries can be minimized to one “wildcard” regex entry.
For Questions, I am here to answer them. This is a serious request. Please no trolling or toxic posts.
If you’re interested in changing DNS responses, you can already do that:
/ip dns static
add name=example.com address=127.0.0.1 match-subdomain=yes
Regexp works too:
/ip dns static
add regexp="^(.*\\.)\?example\\.com\$" address=127.0.0.1
Edit: Or if you mean the new adlist, I didn’t play with that yet. It seems that it’s probably exact match only. Optionally matching subdomain could make sense. Regexp could be too heavy.
for any example.* (valid!!!, is valid also www.example.asdf but asdf actually do not exist…)
also catch *.example.XN–VERMGENSBERATUNG-PWB ( www.example.vermögensberatung )
Sir @rextended, regexp=“(^|\.)mydevice($|\.)” was ment to match “mydevice”, “mydevice.local”, “test.mydevice.net” due to macOS not matching mydevice from Finder or Terminal.
If you have a better suggestion, your contribution is always appreciated
In general it can be said that “wildcard” matching of DNS requests is usually used for what would better be accomplished with subdomain matching (the example shown in this topic is another case of that).
You do not want regexp matching in your resolver with a long list, because for each and every DNS request ALL the regexps have to be evaluated to see if they match, and that is often an expensive operation.
Instead, subdomain match only has to look at the DNS labels (remember a name like www.example.com is already sent as [www][example][com] in a DNS request (I mean it is sent as 3 separate fields), so that is much more efficient.)
The only thing you really need to request is some way to set the “match-subdomain=yes” flag for DNS entries read from some adlist you configure (which supposedly contains domains for which you want to allow subdomains as well).
I think what you need to suggest (to MikroTik, in a ticket in the support system, posting suggestions in the forum is useless!) is to extend the adlist mechanism so those lines with ||example.com^ are recognized where the ^ is just removed, and the || as well but it also serves as an indicator that an entry should be put in DNS with match-subdomains=yes flag.
Maybe some more special characters from that syntax can be supported.
But I think that it should not be implemented as regexp match. That is inefficient and normally not necessary.