Adblock-fast: ad-blocking service for dnsmasq, smartdns and unbound

Is there a quick way to suspend/resume ad blocking without having to restart the service?

  1. I have a toggle switch running in HomeAssistant (HA) meant for toggling ads
  2. It can SSH into the router and perform commands
  3. The 3 I need are: suspend, resume and status
  4. adblock has all 3, but it was extremely slow in updating status to the actual value, this makes the toggle switch unusable
  5. I tried the various commands of adblock-fast but they all seem to start and stop the service which is just as slow
  6. Any ideas? Thank you!

The actual adblock-fast stop/start operations are very fast, it's usually resolver (in default installs -- dnsmasq) where restarts are expensive operations. You may want to set dhcp.lan.force=1 to speed it up a bit.

But I do run service dnsmasq restart for other purposes, and it does not take as long as restart the adblock-fast

What does dhcp.lan.force=1 do?

How can I change the StevenBlack - Unified Hosts file? In the StevenBack github repo there are meny combinations of this file, but how to replace the default one in AdblockFast with the one I want to use. Or just an easy way to add it as new, since just adding the github link will not work.

What kind of time difference are we talking about? What's the output of adblock-fast on stop/start?

I'm failing to see what could prevent you from editing/adding new URL given the WebUI and CLI are well documented.

When I try to add the link through the add button it doesn't get processed when AdBlock is started, will appear with that red-cross when i restart through the command line. Obviously just copy pasting the link is not working. That is why I'm asking here and not on the general "network for all" reddit forum. Is it related to needing to add the new file with hosts on "cdn.jsdelivr.net"? I saw through the documentation there is a mentioning of custom filters but points to a document which I don't understand, what I actually need to do to make it working. Hopefully now you understand why I'm asking here.

If this forum is not related to this kind of question, but is related how to add new code and features to the package then ok, I'm in the wrong forum then, I would appreciate if you can tell me the right thread for the above.

What URL are you using for the new list? You must be using an html link instead of a raw link, if I had to guess. Please provide the steps you tried.

1 Like

I used the raw link, for instance this one: https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-only/hosts
I added using the add button at the end
image

I guess its a problem with that list or StevenBlack hosts in general, cause i added something else from raw.githubusercontent and it worked, meaning it reloaded it without error.

Also, like I saw it reported many times before in this thread i also get "Failed to process allow-list!" whenever I do "save and apply" from LUCI. I have to go to CLI and do the reload command, then refresh the view on Luci and that message disappears, it doesn't seem to affect functionality though

It's an issue with StevenBlack lists, some of the lists published there contain non-malicious-domains related records, like:

127.0.0.1 localhost
127.0.0.1 localhost.localdomain
127.0.0.1 local
255.255.255.255 broadcasthost
::1 localhost
::1 ip6-localhost
::1 ip6-loopback
fe80::1%lo0 localhost
ff00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
0.0.0.0 0.0.0.0

So they needed to be sanitized before sending the content to dnsmasq and the tags which I used to filter these records out are not present in all their lists.

Should be fixed in 1.1.8-22 presently available from my repo and I'll merge fixes into 23.05, 24.10 and snapshots OpenWrt repositories before the end of the week hopefully.

I can't reproduce this so I can't figure out what's going on to fix. :frowning:

1 Like

Yeah, every time hitting "Save and Apply" on Luci, even without changing anything. And there is just the default on the Allowed list
image
image

Then a reload from CLI and refresh page and its ok, so just a cosmetic issue lol

p.s also Stop/Start service from Luci clears the message

1 Like

Could you please post the entire (as minimal as possible) config which allows you to reliably reproduce this issue, so I would test it locally? It would be invaluable for me to resolve this.

Hopefully sometime for that cosmetic issue.

I'm using the dnsmasq servers file as Dns service. I decided to try the dnsmasq.addnhosts option, and got a "not enough memory" error message when the service was trying to reload. Since Luci/ssh freezed and internet went off, had to manually reboot the router. The documentation warned about this option requiring more RAM but I wrongly thought having 1/3 free Ram out of 256 would suffice.

Thanks for the feedback. As only some dnsmasq options support final block-list optimization, some others may take significantly more space, even more so with IPv6 support. I'll try to address it better in the future versions.

1 Like

Using adblock-fast 1.1.2-r20 on a Cudy TR1200, blocking was not working. For whatever reason /var/run/adblock-fast was not 0755 so dnsmasq was unable to load the additional servers file.

I added this nasty 1-liner to /etc/init.d/{adblock-fast,dnsmasq} to allow the servers load at reboot (was too lazy to investigate further).

ADBLOCKDIR="/var/run/adblock-fast/" ; [ -e "${ADBLOCKDIR}" ] && chmod -R a+rX "${ADBLOCKDIR}"

Versions

  • model: Cudy TR1200 v1
  • platform: ramips/mt76x8
  • architecture: MediaTek MT7628AN ver:1 eco:2
  • kernel: 6.6.67
  • OpenWrt: 24.10.0-rc4 r28211-d55754ce0d / LuCI openwrt-24.10 branch 25.011.06450~2520588
  • adblock-fast: 1.1.2-r20
  • luci-app-adblock-fast: 1.1.2-r18
  • dnsmasq: 2.90-r3

What should be added in the allowed-list not to break Google related sites when using dnsmasq.nftset? I added keep.google.com and google-analytics.com
, yet changes in google keep are not saved.

Found cache file, reusing it [✓]
Restarting dnsmasq [✓]
adblock-fast 1.1.2-r22 is blocking 78160 domains (with dnsmasq.nftset) [✓]

How can I delete the cache file without restarting the router?