adblock improvements

Issue #76 resolved
rs232 created an issue

I think a good way forward for adblock is to have the references to the lists defined on a file in Internet e.g. github.

See this example:

Blacklisting

Given a central master list file e.g. https://raw.githubusercontent.com/Fresh-Tomato/adblock/main/adblock-master-list.txt

Modify the current adblock FT implementation to fetch a single default adblock lists from there rather than NVRAM variables.

This file as per above in created with 4 columns: 0/1/2 as a header of each line; second column defines the list size in KB, third column the URI and the 4th column an optional description. Fields to be space separated.

The headers (column one) number specifically defines::

0 blacklist disabled by default

1 blacklist enabled by default

2 blacklist erros detected (e.g. not reachable) list not usable any more

Whitelisting

About whitelisting: a user would be able to define a single customisable URI where whitelisted info should be fetched. Again little NVRAM usage compared to listing potentially dozen of domains in NVRAM. Whitelist format to be defined but it should be a s simple as a list of domains (one per line). I believe this to be already possible but it requires some scripting which could be automated in v2.0.

RAM Capacity

Within the import/add function verify if the list processed would fit in the current free RAM or not and act accordingly.

Summary

So a default tomato adblock behaviour could be:

  • When adblock is started, download the master-list
  • Accept suggested default lists (defined by 1) and ignore the rest (0 and 2)
  • Attempt to overwrite locally the behaviour above with a simple NVRAM 0/1 on a list basis, defining if to use or not a list e.g. adblock_lists=”1,-,-,0,0,1,0,0,0,0,0,0” would force to use list number 1,,,6 to be used, 2 and 3 (undefined) to accept the master-list defaults and force off all the equivalent to 0s regardless of the master-list settings.
  • any attempt to use a broken list (defined centrally with a heading 2) would be skipped regardless of the local settings
  • verification on the total amount of RAM required before attempting to load
  • Blacklist custom: is the blacklist custom URI is defined download and use it. Fully users customisable e.g. personal github
  • Whitelist behaviour: if the whitelist URI of the file is defined download and use it. Fully users customisable e.g. personal github

The advantage of this solution are:

  • lists are not statically defined in the firmware
  • disappearing blacklists can be disabled centrally
  • no need to maintain an accurate default lists within tomato as this is evolving actively
  • new blacklists (if any) can be added centrally
  • optimise NVRAM usage (only 5 varibles needed: enable-disabled/default master-list URI, list usage preference, custom blacklist URI, whitelist URI). These varialbe are of a well controlled size and never become large.
  • bacause public blacklists are stored on github and users can act/affect directly with poll requests
  • github scripting could spot automatically broken lists and disable accordingly (adding a 2 as a header)
  • Free RAM Vs lists size to be handled (no unexpected crash due to lack of RAM)
  • for blacklist custom these are user defined and stored in Internet (e.g. personal github) no need for local sorage
  • for whitelisting these are user defined and stored in Internet (e.g. personal github) no need for local sorage

Conclusion

This is an idea on the same wave of TTB where non-sensitive/not-function-critical information is moved-off the firmware reducing build size and nvram usage where possible.

Comments (4)

  1. pedro repo owner

    I am not entirely convinced of this idea:

    • user has no control what lists are loaded into adblock by default - this is very bad behaviour of FW in own device
    • who will maintain this list of lists?
    • the gain on NVRAM is not that big at all

  2. rs232 reporter

    This proposal is here for discussion so any question/doubt is totally welcome.

    • the lists are public and visible in the master-list, actually from the GUI you would download them matser-list and display the content this can be a simple file downloaded in /tmp (so RAM)
    • Since it’s on github you would expect users to maintain this. At the moment the same people involved in TTB have approval on pull requests at that URL above, but this is just a suggestion like a proof of concept.
    • The gain on NVRAM is particularly noticeable with custom blacklists and whitelists. For a couple of domains probably not relevant but if you start to whitelist/blacklist 20 domains+ those nvram variables might become very big.

  3. Log in to comment