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

As far as I gathered from the code, smartdns configures dnsmasq to use smartdns as a resolver, so dnsmasq is still used in front of smartdns. So just configure adblock-fast to use dnsmasq.servers option and it should work (in default smartdns config).

Thanks to prompt replies and testing from smartdns maintainer, adblock-fast 1.1.0-1 natively supports adblocking with smartdns using its domainset feature.

Make sure to upgrade both adblock-fast and luci-app-adblock-fast.

hello guys, i installed adblock fast following the documentation on openwrt website, selected the lists enabled and started but seems it not working.

is there anything else i need to setup?

It's puzzling, what do service adblock-fast status and service adblock-fast info say?

@stangri The config_update_url seems to be inconsistent with what’s on Github (…config.update versus …conf.update).

1 Like

Good catch, thank you, I'll push the bugfix!

Is there any way to avoid the firewall restart if we’re not using force_dns? It resets all my fw4 and SQM counters. :nerd_face:

1 Like

Another good catch. I'll need to think about how to still restart it if the force_dns setting is changed from 1 to 0, but you're welcome to test adblock-fast 1.1.0-2 from my repo for now.

1 Like

Thanks, I suppose there may also be implications for people using ipset or nftset?

Will give it a spin after lunch!

I get some uci messages during install and same during a restart.

# opkg install /tmp/adblock-fast_1.1.0-2_all.ipk
Upgrading adblock-fast on root from 1.0.1-6 to 1.1.0-2...
Stopping service and removing rc.d symlink for adblock-fast
Stopping adblock-fast 1.0.1-6... [✓]
Command failed: Not found
Configuring adblock-fast.
Starting adblock-fast 1.1.0-2...
/sbin/uci: Entry not found
[DL] Blocked File: big.oisd.nl (adblockplus) [✓]
Sorting combined list [✓]
Optimizing combined list [✓]
Allowing domains [✓]
Formatting merged file [✓]
Creating dnsmasq config file [✓]
Creating compressed cache [✓]
Removing temporary files [✓]
/sbin/uci: Entry not found
Restarting dnsmasq [✓]
adblock-fast 1.1.0-2 is blocking 213790 domains (with dnsmasq.conf) [✓]
Collected errors:
 * resolve_conffiles: Existing conffile /etc/config/adblock-fast is different from the conffile in the new package. The new conffile will be placed at /etc/config/adblock-fast-opkg.
config adblock-fast 'config'
        option enabled '1'
        option allow_non_ascii '0'
        option canary_domains_icloud '1'
        option canary_domains_mozilla '1'
        option compressed_cache '1'
        option compressed_cache_dir '/etc'
        option config_update_enabled '0'
        option config_update_url 'https://cdn.jsdelivr.net/gh/openwrt/packages/net/adblock-fast/files/adblock-fast.conf.update'
        option curl_max_file_size '30000000'
        option curl_retry '3'
        option debug '0'
        option dns 'dnsmasq.conf'
        list dnsmasq_instance '*'
        option download_timeout '10'
        option force_dns '0'
        list force_dns_port '53'
        list force_dns_port '853'
        option parallel_downloads '1'
        option pause_timeout '20'
        option procd_trigger_wan6 '0'
        option procd_boot_delay '0'
        option procd_boot_wan_timeout '60'
        option verbosity '2'

But more importantly, the firewall doesn’t restart!

Thanks, this and a lot more fixed in adblock-fast 1.1.0-3. I'll probably merge existing PRs first and then create new ones for the new code.

1 Like

manually restarting the service seems to work, dont know why its dont start automatically after a reboot.

Hello Stan.
I saw your notice about migration to new repository, checked it out, attempted to follow, but the installation process trips in a weird spot.

Configuring adblock-fast.
Starting adblock-fast 1.1.0-3... /sbin/uci: Entry not found
grep: unrecognized option: P
BusyBox v1.35.0 (2023-03-09 23:13:29 UTC) multi-call binary.

and it just stops.
Restarting the service yields the same results. I don't think that acquiring the grep lib from somewhere else than the official openwrt source is a good idea, so I am coming back to you.

Cheers

Could you please elaborate on this? I don't recall posting a notice about migration to a new repository.

Can you please point to where you've been instructed to "acquire the grep lib from somewhere else than the official openwrt source"?

I believe this was fixed before the package was pushed to OpenWrt repo.

Thanks for bringing it up, seems to be an issue with the busybox built-in grep, I'll see how can I fix it.

Fixed in 1.1.0-4 available from my repo, I'll push the fix to OpenWrt repo today/tomorrow.

PS. If you install grep right now, the second error will be gone.

Hello stangri, my beautiful keyboard surfer.

New repository, means from simple-adblock to adblock-fast

It is my own idea to acquire an alternative version of grep to satisfy requirements of you application. No longer relevant.

The /sbin/uci issue might have been related to the service not installing correctly, hence the execution errors.

THANK YOU for the rapid fix.
The service itself now works correctly, I was able to enable a file_url source and it functions as expected.

But!

Placing

list blocked_domain 'google.com'

in the configuration file, does not block the domain, despite the service status showing "currently blocking one domain". (mass blocking from file_url works fine though)

And!
The luci-app-adblock-fast shows an error and no configuration options

#### RPCError

RPC call to uci/get failed with ubus code 4: Resource not found at ClassConstructor.handleCallReply (http://router.device.local.address/luci-static/resources/rpc.js?v=git-23.292.78392-9f66674:15:3)

It might be important, that I have git-23.093.42303-d58cd69 version of Luci on my device.

Cheers and thank you stangri.

Edit:
I've quickly reflashed the latest firmware and the same issue persist.
Now on luci git-23.051.66410-a505bb1

How do you test?

Can you post the complete adblock-fast config file as well as output from ubus call system board?

I open google.com on client devices. Or a gambling website.
Or ping the same domain from router inferface. No difference.
google.com in list blocked_domain does not get blocked, while gambling website, from file_url is blocked.

Config

config adblock-fast 'config'
        option enabled '1'
        list allowed_domain 'cdn.jsdelivr.net'
        option allow_non_ascii '0'
        option canary_domains_icloud '0'
        option canary_domains_mozilla '0'
        option compressed_cache '0'
        option compressed_cache_dir '/etc'
        option config_update_enabled '0'
        option config_update_url 'https://cdn.jsdelivr.net/gh/openwrt/packages/net/adblock-fast/files/adblock-fast.config.update'
        option curl_max_file_size '30000000'
        option curl_retry '3'
        option debug '0'
        option dns 'dnsmasq.servers'
        list dnsmasq_instance '*'
        option download_timeout '10'
        option force_dns '1'
        list force_dns_port '53'
        list force_dns_port '853'
        option led 'none'
        option parallel_downloads '1'
        option pause_timeout '20'
        option procd_trigger_wan6 '0'
        option procd_boot_delay '0'
        option procd_boot_wan_timeout '60'
        option verbosity '2'

        list blocked_domain 'google.com'

config file_url
        option url 'http://sbc.io/hosts/alternates/fakenews-gambling-porn/hosts'
        option size '6770929'
        option action 'block'
        option enabled '1'

system board info

{
        "kernel": "5.15.137",
        "hostname": "OpenWrt",
        "system": "MediaTek MT7621 ver:1 eco:3",
        "model": "Netgear R6350",
        "board_name": "netgear,r6350",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "23.05.2",
                "revision": "r23630-842932a63d",
                "target": "ramips/mt7621",
                "description": "OpenWrt 23.05.2 r23630-842932a63d"
        }
}

Sorry, last question -- which version of adblock-fast is that?

Ofcourse Stangri. It has been this 1.1.0-4 version since this update notice:

1 Like