177b2dcc015c48e5a03f5d0868a6bce1d5c99e19
[openwrt/openwrt.git] / package / network / services / dnsmasq / patches / 0010-Log-warning-on-very-large-cachesize-config-instead-o.patch
1 From 1f1873aadd092a0fab505dd278a484d887ba0ec3 Mon Sep 17 00:00:00 2001
2 From: Simon Kelley <simon@thekelleys.org.uk>
3 Date: Fri, 11 May 2018 23:38:23 +0100
4 Subject: [PATCH 10/17] Log warning on very large cachesize config, instead of
5 truncating it.
6
7 Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
8 ---
9 src/dnsmasq.c | 6 +++++-
10 src/option.c | 2 --
11 2 files changed, 5 insertions(+), 3 deletions(-)
12
13 --- a/src/dnsmasq.c
14 +++ b/src/dnsmasq.c
15 @@ -740,7 +740,11 @@ int main (int argc, char **argv)
16 else
17 {
18 if (daemon->cachesize != 0)
19 - my_syslog(LOG_INFO, _("started, version %s cachesize %d"), VERSION, daemon->cachesize);
20 + {
21 + my_syslog(LOG_INFO, _("started, version %s cachesize %d"), VERSION, daemon->cachesize);
22 + if (daemon->cachesize > 10000)
23 + my_syslog(LOG_WARNING, _("cache size greater than 10000 may cause performance issues, and is unlikely to be useful."));
24 + }
25 else
26 my_syslog(LOG_INFO, _("started, version %s cache disabled"), VERSION);
27
28 --- a/src/option.c
29 +++ b/src/option.c
30 @@ -2603,8 +2603,6 @@ static int one_opt(int option, char *arg
31
32 if (size < 0)
33 size = 0;
34 - else if (size > 10000)
35 - size = 10000;
36
37 daemon->cachesize = size;
38 }