I use adblock on my LuCI openwrt-23.05 branch (git-24.073.29889-cd7e519) router.
works fine.
I wanted to block TLD .io so the kids wouldn't play snake.io all the time.
There was some DTP (difficult to parse) message when I saved the config in LUCI.
Things didn't seem to work immediately so I rebooted the router.
Still didn't work: picked a new domain but it got resolved: agar.io
So what am I doing wrong?
Adblock requires a 2-level domain for the blacklist (no TLDs).
1 Like
perhaps adblock-fast does allow TLD blocks. I haven't tried this myself.
opened 10:59PM - 18 Jan 24 UTC
closed 11:57PM - 18 Jan 24 UTC
**Maintainer**: @stangri
**Environment**:
* OpenWrt 23.05.0, r23497-6637af9… 5aa
* system type : MediaTek MT7628AN ver:1 eco:2
* machine : GL-MT300N-V2
* cpu model : MIPS 24KEc V5.5
**Description**: I would like to block entire TLDs with adblock-fast.
I see there is some support for optimizing the generated block list by skipping all of, say, `badhost1.example.com`, `badhost2.example.com`, ..., `badhost16777216.example.com` if `example.com` is present in a list. It'd be great to extend this to entire TLDs.
Consider a big list like [StevenBlack/hosts](https://github.com/StevenBlack/hosts); there are over 6700 `.top` entries and I'd prefer to just sinkhole that entire TLD. I tried three approaches, none of which worked to block TLDs:
* Using a domain list of TLDs I wish to block, like any other block list
* Using the blocked domains list with no leading ".", eg. `top`, `click` , `win`
* Using the blocked domains list with leading ".", eg. `.top`, `.click` , `.win`
Back in the `simple-adblock` days, I added something like this extra stage to my running instances, which would exclude all domains ending with a blocked tld from the generated dnsmasq file, and replace them with a single entry for that TLD. Depending on the list of blocked TLDs and block list subscriptions, this could easily shrink the size of the merged list by tens of thousands of entries. Depending on my specific blocksThis has produced no (or acceptably low) false positives.
```
--- simple-adblock-1.8.4.10-orig 2021-12-19 19:27:47.095736330 -0800
+++ simple-adblock-1.8.4.10 2021-12-19 19:27:46.839732223 -0800
@@ -792,6 +792,24 @@
mv "$A_TMP" "$B_TMP"
fi
+ # TLD ...
+ # If you have a list of blocked domains (maybe even TLDs) this
+ # bit will filter all of them out of the block files. It does this
+ # by building converting the "blacklist_domain" list to a regex to
+ # excludes lines matching the blocked domains. These domains
+ # are then used to begin the dnsmasq config, followed by blocked
+ # domains that passed the local filter.
+ #
+ output 2 "Filtering locally configured domain list "
+ # So you can efficiently block all of .com/.org/.net if you want...
+ RGX=$(uci -X show simple-adblock.config.blocked_domain | cut -d = -f 2 | sed -e 's/ /\n/g'| grep -v '[.]' | tr -d "'" | xargs | tr " " "|" )
+ #echo $RGX | tr '|' '\n' | sed -e "s,^,local=/," -e 's,$,/,' > $A_TMP
+ echo $RGX | tr '|' '\n' > $A_TMP
+ egrep -v "[.]($RGX)" $B_TMP >> $A_TMP
+ mv $A_TMP $B_TMP
+ output_ok
+ # TLD ...
+
output 2 'Allowing domains '
tmpfs set message "$(getStatusText "statusProcessing"): allowing domains"
if sed -i "$w_filter" "$B_TMP"; then
```
Yes it does. That’s what I’m currently using and I just tested blocking the google TLD.
antonk
January 23, 2025, 12:21am
5
adblock-lean allows TLD blocking since the last update as well.
system
Closed
February 2, 2025, 12:22am
6
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.