diff options
author | Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk> | 2021-07-09 22:48:49 +0100 |
---|---|---|
committer | Simon Kelley <simon@thekelleys.org.uk> | 2021-07-09 22:48:49 +0100 |
commit | 767d9cbd9692fb7722b05ac60ee261ad25a5d113 (patch) | |
tree | 4f312092c323b100b992489112e4635b1d07d5f7 | |
parent | e7ccd95c04f5108db23d97f409caf7e739a1c51e (diff) | |
download | dnsmasq-767d9cbd9692fb7722b05ac60ee261ad25a5d113.tar.gz |
Add --quiet-tftp.
-rw-r--r-- | man/dnsmasq.8 | 7 | ||||
-rw-r--r-- | src/dnsmasq.h | 3 | ||||
-rw-r--r-- | src/option.c | 3 | ||||
-rw-r--r-- | src/tftp.c | 3 |
4 files changed, 11 insertions, 5 deletions
diff --git a/man/dnsmasq.8 b/man/dnsmasq.8 index 7ddd05b..b6a1f27 100644 --- a/man/dnsmasq.8 +++ b/man/dnsmasq.8 @@ -1612,10 +1612,11 @@ tried. This flag disables this check. Use with caution. Extra logging for DHCP: log all the options sent to DHCP clients and the tags used to determine them. .TP -.B --quiet-dhcp, --quiet-dhcp6, --quiet-ra +.B --quiet-dhcp, --quiet-dhcp6, --quiet-ra, --quiet-tftp Suppress logging of the routine operation of these protocols. Errors and -problems will still be logged. \fB--quiet-dhcp\fP and quiet-dhcp6 are -over-ridden by \fB--log-dhcp\fP. +problems will still be logged. \fB--quiet-tftp\fP does not consider file not +found to be an error. \fB--quiet-dhcp\fP and quiet-dhcp6 are over-ridden by +\fB--log-dhcp\fP. .TP .B \-l, --dhcp-leasefile=<path> Use the specified file to store DHCP lease information. diff --git a/src/dnsmasq.h b/src/dnsmasq.h index 5c8364c..a88cbc5 100644 --- a/src/dnsmasq.h +++ b/src/dnsmasq.h @@ -273,7 +273,8 @@ struct event_desc { #define OPT_UMBRELLA 63 #define OPT_UMBRELLA_DEVID 64 #define OPT_CMARK_ALST_EN 65 -#define OPT_LAST 66 +#define OPT_QUIET_TFTP 66 +#define OPT_LAST 67 #define OPTION_BITS (sizeof(unsigned int)*8) #define OPTION_SIZE ( (OPT_LAST/OPTION_BITS)+((OPT_LAST%OPTION_BITS)!=0) ) diff --git a/src/option.c b/src/option.c index bba88e5..964c3b1 100644 --- a/src/option.c +++ b/src/option.c @@ -173,6 +173,7 @@ struct myoption { #define LOPT_UMBRELLA 364 #define LOPT_CMARK_ALST_EN 365 #define LOPT_CMARK_ALST 366 +#define LOPT_QUIET_TFTP 367 #ifdef HAVE_GETOPT_LONG static const struct option opts[] = @@ -351,6 +352,7 @@ static const struct myoption opts[] = { "dynamic-host", 1, 0, LOPT_DYNHOST }, { "log-debug", 0, 0, LOPT_LOG_DEBUG }, { "umbrella", 2, 0, LOPT_UMBRELLA }, + { "quiet-tftp", 0, 0, LOPT_QUIET_TFTP }, { NULL, 0, 0, 0 } }; @@ -536,6 +538,7 @@ static struct { { LOPT_DUMPMASK, ARG_ONE, "<hex>", gettext_noop("Mask which packets to dump"), NULL }, { LOPT_SCRIPT_TIME, OPT_LEASE_RENEW, NULL, gettext_noop("Call dhcp-script when lease expiry changes."), NULL }, { LOPT_UMBRELLA, ARG_ONE, "[=<optspec>]", gettext_noop("Send Cisco Umbrella identifiers including remote IP."), NULL }, + { LOPT_QUIET_TFTP, OPT_QUIET_TFTP, NULL, gettext_noop("Do not log routine TFTP."), NULL }, { 0, 0, NULL, NULL, NULL } }; @@ -761,7 +761,8 @@ static ssize_t tftp_err(int err, char *packet, char *message, char *file) len = snprintf(mess->message, MAXMESSAGE, message, file, errstr); ret += (len < MAXMESSAGE) ? len + 1 : MAXMESSAGE; /* include terminating zero */ - my_syslog(MS_TFTP | LOG_ERR, "%s", mess->message); + if (err != ERR_FNF || !option_bool(OPT_QUIET_TFTP)) + my_syslog(MS_TFTP | LOG_ERR, "%s", mess->message); return ret; } |