Simple-adblock: fast, lean and fully uci/luci configurable AdBlocking

No opinion. I am not a procd expert.

When I add a new blocking domain and after click on the "Save & Apply" button the LEDE device restart and become unstable and i need to reset it. This doesn't happens if I disable simple-adblock (save & apply), add blacklisted domains (save & apply) and re-enable simple-adblock (save & apply). Can you fix this issue?

@Blackmoon -- can you please confirm the model of the router this is happening?

The device is Nexx WT3020.

I suspect it's a memory consumption issue. Try deleting the first blacklist (or a few of the first ones, they are the largest) from the configs and/or you can try @dibdot's adblock package which probably handles low-RAM devices better.

Essentially what I think happens is that when dnsmasq is loaded with the blacklist, it consumes a huge portion of RAM. When you stop/disable the service, the dnsmasq is restarted without the blacklist, freeing up the RAM. Restarting dnsmasq is a very time-consuming process tho, so I'd rather not do it on every reload (when you add a new domain). I'll try to experiment with restarting dnsmasq in background on reload, but I'm afraid it would negatively affect downloading of the blacklists from the internet while dnsmasq is being restarted.

@Blackmoon -- I've pushed simple-adblock 1.5.7-7 to my repo, it restarts dnsmasq before trying to reload the adblock lists on devices with less than 32Mb of free RAM (I used @dibdot's method to detect free RAM). Please let me know if it helps, so I can push the change to the official OpenWrt repo.

@stangri -- Thank you for your update, now i can use simple-adblock successfully! :slight_smile:
However happens a strange thing, in my tests I'm unable to block the domain microsoft.com. This domain is present in "/etc/config/simple-adblock" and "/var/dnsmasq.d/simple-adblock". In my case I don't need to block this domain and mine was only a test, but would be nice to know the reason of this behavior, in the case it will occurs with others domains.

if the domain is preset in /var/dnsmasq.d/simple-adblock (and if you do nslookup microsoft.com on the router it returns NXDOMAIN), but said domain does resolve on a client device, most likely your client device is either configured to use something else besides your router for DNS or your client device has cached DNS for microsoft.com before you've started using adblocking. It's also possible that either the IP for the domain is hardcoded and request for DNS doesn't even leave client device, or it's hardcoded to resolve specific addresses with specific DNS, in which case it can be solved by Force Router DNS option.

You're right, the issue was related to a cached DNS. Now it work like a charm. Thanks again.

1 Like

Hi.
I like everything. But I have a question, will it not conflict with security systems? (antivirus Avast and my defender http://soft2secure.com/knowledgebase/cesar-ransomware)

1 Like

Unless you're running Avast and Defender on your router, it shouldn't. But even if it does -- you're in full control, you can add domains to be blacklisted or remove domains from blacklist by whitelisting them.

2 Likes

OK thanks )))

I'm curious about the 14 blacklists that Simple Adblock uses. I'm not super familiar with the different blacklists that are out there (I've just relied on uBlock Origin and Disconnect defaults); how did you select these particular ones? I would imagine that these 14 would provide pretty comprehensive coverage, but are there particular things that these selected lists don't target (but that some other lists do)? Are they automatically updated on a schedule?

These are all that I know of, that are compatible. Duplicate entries removed automatically, you can try removing various lists from your config and seeing how does that affect the final block list.

1 Like

Hello there,
What is the minimum specs to run Simple Adblock ? My router (DLINK DIR 869 (64Mb Ram) ) is totally unstable why I'm trying to run simple-adblock. I have shell freeze, auto-reboot etc when I'm trying to enable and then download hosts. I monitor the cpu usage with top and find out that it go high when restarting /etc/init.d/simple-adblock or dnsmasq
Help ! :slight_smile:

I have a long system log, where should I put it ?

While I use adblock, not simple-adblock, your router should be powerful enough - but refreshing and keeping the block lists in RAM does require some space, so try to work with a smaller selection of block lists for a start and extend it slowly.

1 Like

After posting my message, I found about that kind of trick. Thanks for confirming it.
By the way, which trigger method is the less memory/cpu consuming ?

Not sure what you mean by "trigger method", but the lists in the default simple-adblock config are ordered by size from largest to smallest. So try removing first one as a start.

1 Like

Hi, works flawlessly but youtube in-video ads (ad video that plays before real video) keeps loading on my iphone 6 and galaxy s4+ youtube official apps

Do you know some solution? Thanks in advance

yes, you need to redirect DNS, this is because Android uses its own DNS instead of advertised by DHCP,

try running:

iptables -t nat -A PREROUTING -s 192.168.1.0/24 -p udp --dport 53 -j DNAT --to 192.168.1.1
iptables -t nat -A PREROUTING -s 192.168.1.0/24 -p tcp --dport 53 -j DNAT --to 192.168.1.1

or

iptables -t nat -A PREROUTING -i br-lan         -p udp --dport 53 -j DNAT --to 192.168.1.1
iptables -t nat -A PREROUTING -i br-lan         -p tcp --dport 53 -j DNAT --to 192.168.1.1

if it work then add it to /etc/firewall.user
try disabling your mobile connection (in that way android will use wifi-only)... and if you keep seeing adgarbage then you need to check if you android if connecting to some 953, 1053, 5353 port, maybe it has a malware that fights for their ads.