Since version 1.6 or so, simple-adblock implemented Dirk's (author of adblock) ingenious system of shrinking the dnsmasq file by removing extra entries. For example, if after downloading block lists the block file contains entries like: advertising.com www.advertising.com www1.advertising.com ads.advertising.com
the last 3 entries can be removed as long as advertising.com stays in the blacklist.
This takes a few extra seconds to process/start but it leads to reduced RAM usage.
Hello, I've recently started using your package and I'm loving it, thank you for making it!
There's also something I've noticed: I believe the hotplug script runs for every interface, which makes it start the service a million times after the system starts. I'm new to openwrt, so I can't be sure exactly about what's going on, but I think this is what's happening.
If the first start was completed successfully (without download errors), repeated calls of /etc/init.d/simple-adblock start should just display the last ran status.
I've just monitored the logs after a reboot to see exactly what's happening and after the first successful start it prints 'Starting simple-adblock 1.7.0-1...' and restarts dnsmasq for each repeated call. This, combined with a rather big log from the dnsmasq itself on each restart, flooded my logs, which is the reason I started digging in the first place, thinking it was some kind of infinite restart thing.
Of course once it's over, it all works perfectly, but dnsmasq restarts are a little excessive, and it certainly catches attention and can be a little confusing when you look at the logs.
Good catch, it should be fixed in 1.7.0-2 (available in my repo). I would appreciate if you test the hell out of it, so I can send PR for the fix to the official repo.
Hi stangri, thanks for releasing more updates. simple-adblock runs great here and will stay with me for a long time!
Just a question: Would you recommend to use a host based blocklist or a URL based blocklist with simple-adblock? Sure, both are supported. But are there advantages with one method over the other? I have a big blocklist that was released in both formats by the author.
Are whitelisted domain entries in URL format fully compatible with blacklisted Host URL entries?
Edit: Talking about following lists, I'm still deciding if Host based of URL based is better.
Both are supported because some of the top lists use either/or and not both.
Given the choice I'd still use domains lists, but difference is negligible, for hosts it's 14 sed rules to filter, for domains it's 11 rules to filter.
PS. recent updates are mostly due to @phasecat's very thorough testing/feedback on fringe cases.
Simple-adblock itself just creates the file for dnsmasq and then exits, it doesn't stay running/doesn't slow anything down.
But with half a million records, dnsmasq may slow down. I only have WRT3200, so I have a list of about 40k records (after built-in optimization) and I've increased the dnsmasq cache size to 1000. If you have plenty of RAM, you may want to try an even higher dnsmasq cache size to see if it helps.
simple-adblock seems to feed dnsmasq the list similarly as the adblock package does. There's currently a discussion regarding the performance, and why it seems to differ so much from for example pi-hole. The discussion started at this post: Adblock support thread
Well, I can't optimize the block list if you want to use addnhosts file, but the provisional support for it is enabled in the 1.7.0-17 available from my development repo: ! grep -q 'stangri_dev_repo' /etc/opkg/customfeeds.conf && echo 'src/gz stangri_dev_repo https://dev.melmac.net/openwrt-repo' >> /etc/opkg/customfeeds.conf
Thank you very much for your clarification! Those are some pretty neat optimizations! However, having the option to use more RAM to get more performance is definitely a welcome one. But I can also understand that this isn't ideal for everyone. So in my opinion your chosen use_addnhosts is a very elegant solution to give users the power to pick what they prefer
Thank you very much for this amazing piece of software! Looking forward to seeing this functionality in mainline
If you have an opportunity to run performance/speed tests on all 3 of these options, please do share the results.
I want to switch the default setting from dnsmasq.conf to dnsmasq.servers because it allows for a very quick DNSMASQ reload after initial setup and afaik it's the default behaviour of Dirk's adblock package.
I am also unsure how to pick between the 3 different DNS resolution options as given on the github page you linked. The github page mentions three different options (actually 4, but you mentioned unbound isn't working yet):
dnsmasq.addnhosts
dnsmasq.conf
dnsmasq.servers
However, in your previous post you mentioned:
So what's the correct way of setting these 3 different modes in the simple-adblock.conf file?
Amazing difference, I think the results speak for themselves From slowest to fastest
The settings that were used was the default configuration file from your development repo. The only thing that was changed was setting enabled to 1, and changing the dns option to the 3 different choices.
So we probably are going to need more/larger lists in order to block everything, since as you already mentioned, subdomains aren't blocked. But since the listsize does not affect performance, and only influences the RAM usage, we are free to fill up that RAM to try to improve the blocking Gonna play around with it some more.
Edit 2:
Hmmm, I uncommented all the lists that were included in the configuration file, but not it's only blocking 20k addresses according to dnsmasq. That was 60k before I uncommented the additional ones. Not sure what's up with that.
Edit 3:
Tried with Pi-holes default lists (110k blocked according to dnsmasq), but I am still seeing the ads on the test page. Could IPv6 have anything to do with it? It shouldn't right? Even if it does the dns request over IPv6, dnsmasq should still return 127.0.0.1 if the name is included in the list, right?