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
base: master
from

Conversation

Projects
None yet
2 participants
@hnyman
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@ldir-EDB0

ldir-EDB0 Feb 7, 2017

Contributor

This should definitely go upstream. LGTM.

Contributor

ldir-EDB0 commented Feb 7, 2017

This should definitely go upstream. LGTM.

@hnyman

This comment has been minimized.

Show comment
Hide comment
@hnyman

hnyman Feb 7, 2017

Contributor

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

Let's see what happens.

Contributor

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.

dnsmasq: decrease the amount of individual sites listed in log
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

This comment has been minimized.

Show comment
Hide comment
@hnyman

hnyman Feb 12, 2017

Contributor

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.

Contributor

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 hnyman:dnsmasq-log branch Feb 12, 2017

@ldir-EDB0

This comment has been minimized.

Show comment
Hide comment
@ldir-EDB0

ldir-EDB0 Feb 13, 2017

Contributor

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

Contributor

ldir-EDB0 commented Feb 13, 2017

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