# HG changeset patch # User Roy Marples # Date 1599036992 -3600 # Node ID 557a3f9f2be4feff22ac41b4852ac9ff5f4e55c9 # Parent dead0d8414020933642f1bbdb45aae83c6c98f28 DHCP: allow leasetime -1 to represent infinity Easier to enter than 4294967295 seconds which is the real representation of infinity. diff -r dead0d841402 -r 557a3f9f2be4 src/dhcpcd.8.in --- a/src/dhcpcd.8.in Tue Sep 01 12:24:42 2020 +0100 +++ b/src/dhcpcd.8.in Wed Sep 02 09:56:32 2020 +0100 @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 31, 2020 +.Dd September 2, 2020 .Dt DHCPCD 8 .Os .Sh NAME @@ -385,8 +385,10 @@ .Nm will exit. .It Fl l , Fl Fl leasetime Ar seconds -Request a specific lease time in +Request a lease time of .Ar seconds . +.Ar -1 +represents an infinite lease time. By default .Nm does not request any lease time and leaves it in the hands of the diff -r dead0d841402 -r 557a3f9f2be4 src/dhcpcd.conf.5.in --- a/src/dhcpcd.conf.5.in Tue Sep 01 12:24:42 2020 +0100 +++ b/src/dhcpcd.conf.5.in Wed Sep 02 09:56:32 2020 +0100 @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd June 18, 2020 +.Dd September 2, 2020 .Dt DHCPCD.CONF 5 .Os .Sh NAME @@ -448,8 +448,14 @@ This is on by default, but is documented here in the case where it is disabled globally but needs to be enabled for one interface. .It Ic leasetime Ar seconds -Request a leasetime of +Request a lease time of .Ar seconds . +.Ar -1 +represents an infinite lease time. +By default +.Nm dhcpcd +does not request any lease time and leaves it in the hands of the +DHCP server. .It Ic link_rcvbuf Ar size Override the size of the link receive buffer from the kernel default. While diff -r dead0d841402 -r 557a3f9f2be4 src/if-options.c --- a/src/if-options.c Tue Sep 01 12:24:42 2020 +0100 +++ b/src/if-options.c Wed Sep 02 09:56:32 2020 +0100 @@ -761,6 +761,10 @@ break; case 'l': ARG_REQUIRED; + if (strcmp(arg, "-1") == 0) { + ifo->leasetime = DHCP_INFINITE_LIFETIME; + break; + } ifo->leasetime = (uint32_t)strtou(arg, NULL, 0, 0, UINT32_MAX, &e); if (e) {