Tweaks to TFTP.
Fail on overlarge files (block numbers are limited to 16 bits)
Honour tftp-max setting in single port mode.
Tweak timeouts, and fix logic which suppresses errors if the
last ACK is missing.
diff --git a/src/dnsmasq.c b/src/dnsmasq.c
index 755bda9..bea57bc 100644
--- a/src/dnsmasq.c
+++ b/src/dnsmasq.c
@@ -956,10 +956,11 @@
{
struct tftp_prefix *p;
- my_syslog(MS_TFTP | LOG_INFO, "TFTP %s%s %s",
+ my_syslog(MS_TFTP | LOG_INFO, "TFTP %s%s %s %s",
daemon->tftp_prefix ? _("root is ") : _("enabled"),
- daemon->tftp_prefix ? daemon->tftp_prefix: "",
- option_bool(OPT_TFTP_SECURE) ? _("secure mode") : "");
+ daemon->tftp_prefix ? daemon->tftp_prefix : "",
+ option_bool(OPT_TFTP_SECURE) ? _("secure mode") : "",
+ option_bool(OPT_SINGLE_PORT) ? _("single port mode") : "");
if (tftp_prefix_missing)
my_syslog(MS_TFTP | LOG_WARNING, _("warning: %s inaccessible"), daemon->tftp_prefix);
@@ -977,7 +978,7 @@
if (max_fd < 0)
max_fd = 5;
- else if (max_fd < 100)
+ else if (max_fd < 100 && !option_bool(OPT_SINGLE_PORT))
max_fd = max_fd/2;
else
max_fd = max_fd - 20;
@@ -1707,6 +1708,7 @@
}
#ifdef HAVE_TFTP
+ /* tftp == 0 in single-port mode. */
if (tftp <= daemon->tftp_max && listener->tftpfd != -1)
poll_listen(listener->tftpfd, POLLIN);
#endif