diff --git a/configure.ac b/configure.ac index 8b58835..074f22f 100644 --- a/configure.ac +++ b/configure.ac @@ -131,12 +131,12 @@ fi # Delayed-ack feature support (experimental). AC_ARG_ENABLE(delayed_ack, - AS_HELP_STRING([--enable-delayed-ack],[queues multiple DHCPACK replies (default is no)])) -if test "$enable_delayed_ack" = "yes"; then + AS_HELP_STRING([--enable-delayed-ack],[queues multiple DHCPACK replies (default is yes)])) +# Delayed-ack is on by default, so define if it is not explicitly disabled. +if test "$enable_delayed_ack" != "no"; then + enable_delayed_ack="yes" AC_DEFINE([DELAYED_ACK], [1], [Define to queue multiple DHCPACK replies per fsync.]) -else - enable_delayed_ack="no" fi # DHCPv6 optional compile-time feature. diff --git a/includes/dhcpd.h b/includes/dhcpd.h index d149792..a37f550 100644 --- a/includes/dhcpd.h +++ b/includes/dhcpd.h @@ -804,7 +804,7 @@ struct lease_state { #endif #if !defined (DEFAULT_DELAYED_ACK) -# define DEFAULT_DELAYED_ACK 28 /* default SO_SNDBUF size / 576 bytes */ +# define DEFAULT_DELAYED_ACK 0 #endif #if !defined (DEFAULT_ACK_DELAY_SECS) diff --git a/server/dhcp.c b/server/dhcp.c index a823a4e..765cf8b 100644 --- a/server/dhcp.c +++ b/server/dhcp.c @@ -3536,7 +3536,7 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp) } else { lease->cltt = cur_time; #if defined(DELAYED_ACK) && !defined(DHCP4o6) - if (enqueue) + if (enqueue && max_outstanding_acks != 0) delayed_ack_enqueue(lease); else #endif diff --git a/server/dhcpd.conf.5 b/server/dhcpd.conf.5 index 9c99676..e051b99 100644 --- a/server/dhcpd.conf.5 +++ b/server/dhcpd.conf.5 @@ -2118,24 +2118,25 @@ statements .B max-ack-delay \fImicroseconds\fR\fB;\fR .PP .I Count -should be an integer value from zero to 2^16-1, and defaults to 28. The -count represents how many DHCPv4 replies maximum will be queued pending -transmission until after a database commit event. If this number is -reached, a database commit event (commonly resulting in fsync() and -representing a performance penalty) will be made, and the reply packets -will be transmitted in a batch afterwards. This preserves the RFC2131 -direction that "stable storage" be updated prior to replying to clients. -Should the DHCPv4 sockets "go dry" (select() returns immediately with no -read sockets), the commit is made and any queued packets are transmitted. +should be an integer value from zero to 2^16-1 and defaults to 0, which means +that the feature is disabled. Otherwise, 28 may be a sensible starting point +for many configurations (SO_SNDBUF size / 576 bytes.) The count represents how +many DHCPv4 replies maximum will be queued pending transmission until after a +database commit event. If this number is reached, a database commit event +(commonly resulting in fsync() and representing a performance penalty) will be +made, and the reply packets will be transmitted in a batch afterwards. This +preserves the RFC2131 direction that "stable storage" be updated prior to +replying to clients. Should the DHCPv4 sockets "go dry" (select() returns +immediately with no read sockets), the commit is made and any queued packets +are transmitted. .PP Similarly, \fImicroseconds\fR indicates how many microseconds are permitted to pass inbetween queuing a packet pending an fsync, and performing the fsync. Valid values range from 0 to 2^32-1, and defaults to 250,000 (1/4 of a second). .PP -Please note that as delayed-ack is currently experimental, the delayed-ack -feature is not compiled in by default, but must be enabled at compile time -with \'./configure --enable-delayed-ack\'. +Please note that delayed-ack is currently experimental so you should test +carefully before enabling this feature. .RE .PP The