Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dnsmasq: decrease the amount of individual sites listed in log #797

Closed
wants to merge 1 commit into from
Closed

dnsmasq: decrease the amount of individual sites listed in log #797

wants to merge 1 commit into from

Conversation

hnyman
Copy link
Contributor

@hnyman hnyman commented Feb 7, 2017

This PR is related to #638 as it tries to tackle the same challenge, log spam from nxdomain based adblock.

I don't want to push all dnsmasq logging into /dev/null or so, but would like to decrease log spam related to blocked ad sites.

By default the 30 first servers are listed individually to system log, and then a count of the remaining items. With e.g. a NXDOMAIN based adblock service, dnsmasq lists 30 unnecessary ad sites every time when dnsmasq evaluates the list (twice at startup). What is worse, the actual nameservers are evaluated last and get included in the "remaining items" total and their details are not displayed.

  • Handle the "local addresses only" separately and list only a few (8) of them. This class includes the blocked ad sites.
  • Remove the "local addresses only" from the general count. Now the general nameserver info etc gets properly displayed.

Run-tested with ipq806x/R7800 at r3324-174ce4c56d

Example output at router startup when adblock gets loaded:

Tue Feb  7 16:57:24 2017 daemon.info dnsmasq[3012]: using local addresses only for domain wwww.adleads.c0m
Tue Feb  7 16:57:24 2017 daemon.info dnsmasq[3012]: using local addresses only for domain www4.smartadserver.c0m
Tue Feb  7 16:57:24 2017 daemon.info dnsmasq[3012]: using local addresses only for domain www3.smartadserver.c0m
Tue Feb  7 16:57:24 2017 daemon.info dnsmasq[3012]: using local addresses only for domain www2.smartadserver.c0m
Tue Feb  7 16:57:24 2017 daemon.info dnsmasq[3012]: using local addresses only for domain www.smartadserver.c0m
Tue Feb  7 16:57:24 2017 daemon.info dnsmasq[3012]: using local addresses only for domain www.pflexads.c0m
Tue Feb  7 16:57:24 2017 daemon.info dnsmasq[3012]: using local addresses only for domain www.mmnetwork.m0bi
Tue Feb  7 16:57:24 2017 daemon.info dnsmasq[3012]: using local addresses only for domain www.eltrafiko.c0m
Tue Feb  7 16:57:24 2017 daemon.info dnsmasq[3012]: using 21051 more local addresses
Tue Feb  7 16:57:24 2017 daemon.info dnsmasq[3012]: reading /tmp/resolv.conf.auto
Tue Feb  7 16:57:24 2017 daemon.info dnsmasq[3012]: using local addresses only for domain wwww.adleads.c0m
Tue Feb  7 16:57:24 2017 daemon.info dnsmasq[3012]: using local addresses only for domain www4.smartadserver.c0m
Tue Feb  7 16:57:24 2017 daemon.info dnsmasq[3012]: using local addresses only for domain www3.smartadserver.c0m
Tue Feb  7 16:57:24 2017 daemon.info dnsmasq[3012]: using local addresses only for domain www2.smartadserver.c0m
Tue Feb  7 16:57:24 2017 daemon.info dnsmasq[3012]: using local addresses only for domain www.smartadserver.c0m
Tue Feb  7 16:57:24 2017 daemon.info dnsmasq[3012]: using local addresses only for domain www.pflexads.c0m
Tue Feb  7 16:57:24 2017 daemon.info dnsmasq[3012]: using local addresses only for domain www.mmnetwork.m0bi
Tue Feb  7 16:57:24 2017 daemon.info dnsmasq[3012]: using local addresses only for domain www.eltrafiko.c0m
Tue Feb  7 16:57:24 2017 daemon.info dnsmasq[3012]: using nameserver 62.241.198.246#53
Tue Feb  7 16:57:24 2017 daemon.info dnsmasq[3012]: using nameserver 62.241.198.245#53
Tue Feb  7 16:57:24 2017 daemon.info dnsmasq[3012]: using nameserver 2001:14b8:1000::1#53
Tue Feb  7 16:57:24 2017 daemon.info dnsmasq[3012]: using nameserver 2001:14b8:1000::2#53
Tue Feb  7 16:57:24 2017 daemon.info dnsmasq[3012]: using 21051 more local addresses

@ldir-EDB0
Copy link
Contributor

This should definitely go upstream. LGTM.

@hnyman
Copy link
Contributor Author

hnyman commented Feb 7, 2017

I submitted it upstream as http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2017q1/011206.html

Let's see what happens.

By default 30 first servers are listed individually to system log, and
then a count of the remaining items. With e.g. a NXDOMAIN based adblock
service, dnsmasq lists 30 unnecessary ad sites every time when dnsmasq
evaluates the list. But the actual nameservers in use are evaluated last
and are not displayed as they get included in the "remaining items" total.

Handle the "local addresses only" separately and list only a few of them.
Remove the "local addresses only" from the general count.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
@hnyman
Copy link
Contributor Author

hnyman commented Feb 12, 2017

This has been applied to the upstream dnsmasq as http://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=commit;h=3e2496fb16fb78cb95fffdac80f967310a34b1fa

So there is no need to take this patch separately into LEDE.

@hnyman hnyman closed this Feb 12, 2017
@hnyman hnyman deleted the dnsmasq-log branch February 12, 2017 14:51
@ldir-EDB0
Copy link
Contributor

And I included it in #816 'cos it missed test3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants