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

only 1.9.3-6 is available

Oh, you're right, I'll create PRs and merge changes some time this coming week.

2 Likes

Bug? I have dbl.oisd.nl as an entry under blocked domains, but when I do an update that entry gets overwritten to hosts.oisd.nl somehow, and the update for that list fails since it's not a domain list

service simple-adblock dl
Updating config ✓
Force-reloading simple-adblock 1.9.3-6...
Downloading lists ✓✓✓✓✗✓✓✓
Processing downloads ✓✓✓✓✓✓✓
Reloading dnsmasq ✓
simple-adblock 1.9.3-6 is blocking 74890 domains (with dnsmasq.servers) ✓
ERROR: failed to parse https://hosts.oisd.nl/!

This keeps happening to me repeatedly and it's getting frustrating at this point

Edit: just tested again and as soon as I did service simple-adblock dl to force a list update over SSH, that's what's overwriting that specific entry

1 Like

Thanks, I believe it's related to oisd changing the domain name and the config-update file had this erroneous entry due to that.

Fixed in 1.9.3-7: https://github.com/openwrt/packages/pull/20446 https://github.com/openwrt/packages/pull/20447

2 Likes

same error after upgrading to 1.9.3-7

Mon Feb  6 18:38:51 2023 daemon.err dnsmasq[3869]: cannot read /var/run/simple-adblock/dnsmasq.servers: No such file or directory
Mon Feb  6 18:38:58 2023 user.notice simple-adblock [9008]: ERROR: The service service failed to discover WAN gateway!!
Mon Feb  6 18:38:58 2023 user.notice simple-adblock [9008]: WARNING: Some recommended packages are missing, install them by running:
Mon Feb  6 18:38:58 2023 user.notice simple-adblock [9008]: opkg update; opkg --force-overwrite install gawk grep sed;
Mon Feb  6 18:38:58 2023 user.notice simple-adblock [9008]: ERROR: The service service failed to discover WAN gateway!!

Does it ever start on its own on bootup? Does it start manually?

no same error as before

Hey guys, I'm running into a strange issue (Dnsmasq crashing intermittently when disabling interfaces, would like to adjust procd respawn parameters) where one out of every 20 times or so when I disable wifi or enable wifi using "wifi up", "wifi down" from the root shell dnsmasq crashes during the restart 6 times in a row (all within afew seconds). This means that I manually need to set a static ip to get back in and restart it, mean while all my devices are disconnected from the internet. It took me a while to figure out that simple-adblock was what was trigger dnsmasq restart on interface up/down changes, as dnsmasq by itself is configured to simply do a "reload" not a "restart".

The error in my logs is as follows.

Sun Feb  5 19:41:08 2023 kern.info kernel: [290008.019012] device wlan0 left promiscuous mode
Sun Feb  5 19:41:08 2023 kern.info kernel: [290008.028743] br-lan: port 5(wlan0) entered disabled state
Sun Feb  5 19:41:08 2023 daemon.notice netifd: Wireless device 'radio1' is now down
Sun Feb  5 19:41:09 2023 daemon.notice netifd: Network device 'wlan0' link is down
Sun Feb  5 19:41:09 2023 daemon.notice netifd: Wireless device 'radio0' is now down
Sun Feb  5 19:41:11 2023 daemon.info dnsmasq[1]: exiting on receipt of SIGTERM
Sun Feb  5 19:41:11 2023 daemon.info procd: Instance dnsmasq::cfg01411c s in a crash loop 6 crashes, 0 seconds since last crash

You can see that after the wifi interface goes down, within 2 seconds it procd has already retried and failed 6 times. to restart dnsmasq and ultimately gives up. I'm a little uncertain why when simple-adblock restarts dnsmasq it doesn't have the default procd 5 second retry delay (if it did I don't think this would be failing). I'm also curious what subsequent chain of cascading events after an interface down event is making simple-adblock restart dnsmasq. I'm thinking perhaps if I just comment that section out I will be able to work around the issue, without disable dnsmasq restart in all scenarios.

Thanks!

I'm not seeing anything from simple-adblock in this log.

Please post your /etc/config/simple-adblock and /etc/config/network, as well as output of service simple-adblock info.

Hey @stangri ,

Below are the outputs you requested.

root@OpenWrt:~# cat /etc/config/simple-adblock

config simple-adblock 'config'
	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 config_update_enabled '0'
	option config_update_url 'https://cdn.jsdelivr.net/gh/openwrt/packages/net/simple-adblock/files/simple-adblock.conf.update'
	option curl_retry '3'
	option download_timeout '10'
	option debug '0'
	option dns 'dnsmasq.servers'
	option dns_instance '0'
	option force_dns '1'
	list force_dns_port '53'
	list force_dns_port '853'
	option parallel_downloads '1'
	option procd_trigger_wan6 '0'
	option verbosity '2'
	list blocked_hosts_url 'https://adaway.org/hosts.txt'
	list blocked_hosts_url 'https://cdn.jsdelivr.net/gh/hoshsadiq/adblock-nocoin-list/hosts.txt'
	list blocked_hosts_url 'https://pgl.yoyo.org/as/serverlist.php?hostformat=hosts&showintro=1&mimetype=plaintext'
	list blocked_hosts_url 'https://winhelp2002.mvps.org/hosts.txt'
	list blocked_hosts_url 'https://someonewhocares.org/hosts/hosts'
	list blocked_domains_url 'https://cdn.jsdelivr.net/gh/AdguardTeam/cname-trackers@master/combined_disguised_trackers_justdomains.txt'
	option enabled '1'
	list blocked_domain 'su-dev.lge.com'
	list blocked_domain 'su-ssl.lge.com'
	list blocked_domain 'su.lge.com'
	list blocked_domain 'snu.lge.com'
	list blocked_domain 'snu-dev.lge.com'
	list blocked_domain 'snu-ssl.lge.com'

root@OpenWrt:~# cat /etc/config/network

config interface 'loopback'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'
	option device 'lo'

config globals 'globals'
	option packet_steering '1'
	option ula_prefix 'fdff:3788:1b05::/48'

config interface 'lan'
	option proto 'static'
	option netmask '255.255.255.0'
	option ip6assign '60'
	option device 'br-lan'
	option ipaddr '192.168.10.1'

config interface 'wan'
	option keepalive '5 10'
	option device 'wan'
	option proto 'dhcp'

config interface 'wan6'
	option proto 'dhcpv6'
	option device 'wan'
	option reqaddress 'try'
	option reqprefix 'auto'

config interface 'guest'
	option proto 'static'
	option netmask '255.255.255.0'
	option ipaddr '192.168.13.1'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'lan2'
	list ports 'lan3'
	list ports 'lan4'

config interface 'modem'
	option proto 'static'
	option device '@wan'
	list ipaddr '192.168.128.100'

config interface 'guest_lan'
	option proto 'static'
	option device 'lan1'
	option netmask '255.255.255.0'
	option ipaddr '192.168.14.1'

root@OpenWrt:~# service simple-adblock info
{
	"simple-adblock": {
		"instances": {
			"main": {
				"running": false,
				"command": [
					"/bin/true"
				],
				"term_timeout": 5,
				"exit_code": 0,
				"data": {
					"entries": 56190,
					"errors": "",
					"firewall": [
						{
							"type": "redirect",
							"target": "DNAT",
							"src": "lan",
							"proto": "tcp udp",
							"src_dport": "53",
							"dest_port": "53",
							"reflection": false
						},
						{
							"type": "rule",
							"src": "lan",
							"dest": "*",
							"proto": "tcp udp",
							"dest_port": "853",
							"target": "REJECT"
						}
					],
					"status": "statusSuccess"
				}
			}
		},
		"triggers": [
			[
				"interface.*",
				[
					"if",
					[
						"eq",
						"interface",
						"wan"
					],
					[
						"run_script",
						"/etc/init.d/simple-adblock",
						"start"
					]
				],
				1000
			],
			[
				"config.change",
				[
					"if",
					[
						"eq",
						"package",
						"simple-adblock"
					],
					[
						"run_script",
						"/etc/init.d/simple-adblock",
						"reload"
					]
				],
				1000
			]
		]
	}
}

I also ran a simple test adding a new ad block dns filter and saving changes and confirmed it restarted dnsmasq.

Wed Feb  8 11:39:38 2023 user.notice simple-adblock [4844]: WARNING: Some recommended packages are missing, install them by running:
Wed Feb  8 11:39:38 2023 user.notice simple-adblock [4844]: opkg update; opkg --force-overwrite install gawk grep sed coreutils-sort;
Wed Feb  8 11:39:38 2023 user.notice simple-adblock [4844]: Force-reloading simple-adblock 1.9.3-6...
Wed Feb  8 11:39:39 2023 user.notice simple-adblock [4844]: [DL] Blocked Hosts:   cdn.jsdelivr.net [✓]
Wed Feb  8 11:39:41 2023 user.notice simple-adblock [4844]: [DL] Blocked Hosts:   adaway.org [✓]
Wed Feb  8 11:39:41 2023 user.notice simple-adblock [4844]: [DL] Blocked Hosts:   pgl.yoyo.org [✓]
Wed Feb  8 11:39:42 2023 user.notice simple-adblock [4844]: [DL] Blocked Hosts:   winhelp2002.mvps.org [✓]
Wed Feb  8 11:39:44 2023 user.notice simple-adblock [4844]: [DL] Blocked Hosts:   someonewhocares.org [✓]
Wed Feb  8 11:39:47 2023 user.notice simple-adblock [4844]: [DL] Blocked Domains: cdn.jsdelivr.net [✓]
Wed Feb  8 11:39:50 2023 user.notice simple-adblock [4844]: Sorting combined list [✓]
Wed Feb  8 11:40:35 2023 user.notice simple-adblock [4844]: Optimizing combined list [✓]
Wed Feb  8 11:40:36 2023 user.notice simple-adblock [4844]: Allowing domains [✓]
Wed Feb  8 11:40:37 2023 user.notice simple-adblock [4844]: Formatting merged file [✓]
Wed Feb  8 11:40:38 2023 user.notice simple-adblock [4844]: Creating dnsmasq servers file [✓]
Wed Feb  8 11:40:38 2023 user.notice simple-adblock [4844]: Removing temporary files [✓]
Wed Feb  8 11:40:38 2023 daemon.info dnsmasq[1]: exiting on receipt of SIGTERM
Wed Feb  8 11:40:45 2023 daemon.info dnsmasq[1]: started, version 2.86 cachesize 150

It seems like the error may be some race condition with bringing up and down the wifi interface and restarting dnsmasq, but I'm not entirely sure. It only happens about once every 50 times for me.

Yes, I have to start it manually after reboot or power failure. By going to system > startup and restart simple-adblock

Yes, upon block-list update, dnsmasq restart is required to flush cache.

The only thing happening on WAN interface trigger (as evidenced by the output you've provided) is /etc/init.d/simple-adblock start. If simple-adblock has successfully started before (as in, there were no errors in downloads/processing), it results in something like below in CLI/log:

05:52:56 simple-adblock [5880]: service is blocking 426134 domains (with dnsmasq.servers) ✓

So I don't see how simple-adblock is a cause for dnsmasq restart when you bring down wifi.

I've tested wifi down and wifi up on my router and I can't reproduce your issue.

Anything unusual about your WAN? How long does it take to come online?

1 Like

Thanks a bunch for checking on my behalf! I will need to do some more experimenting and post back here with my findings if it turns out it is indeed simple-adblock causing the restart of dnsmasq. I apologize if I have been wrong in my assessment.

1 Like

Nothing unusual with WAN as far as I can tell. It's a pppoe wan connection with vdsl modem.

Could you please post/PM me the /etc/config/network, I may make a build which waits a bit longer for pppoe connections to come up.

1 Like

If you do have logs or anything to indicate it's a simple-adblock doing, let me know.

cat /etc/config/network

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd74:3bca:1fc1::/48'
        option packet_steering '0'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option ipaddr '192.168.1.2'

config device
        option type '8021q'
        option ifname 'eth1'
        option vid '10'
        option name 'eth1.10'

config device
        option type '8021q'
        option ifname 'eth1'
        option vid '20'
        option name 'eth1.20'

config interface 'WAN'
        option proto 'pppoe'
        option device 'eth1.10'
        option username '****'
        option password '***'
        option ipv6 'auto'
        option peerdns '0'
        list dns '8.8.8.8'
        list dns '8.8.4.4'
        option mtu '1500'
        option ac '***'

config interface 'IPTV'
        option proto 'static'
        option device 'eth1.20'
        option ipaddr '10.10.10.1'
        option netmask '255.255.255.0'

config interface 'modem'
        option proto 'static'
        option device 'eth1'
        option ipaddr '192.168.10.5'
        option netmask '255.255.255.0'

config device
        option name 'eth1'

config interface 'wan6'
        option proto 'dhcpv6'
        option device '@WAN'
        option reqaddress 'try'
        option reqprefix 'auto'
        option peerdns '0'
        list dns '2001:4860:4860::8888'
        list dns '2001:4860:4860::8844'

1 Like

Thanks for your prompt reply, can you please try simple-adblock 1.9.3-8 from my repo and let me know what it produces on reboot? You may want to set verbosity to 2 before rebooting.

Can you please post the link and tell me how to do it? I am a noob at these things. Just good at following instructions.