Mercurial > hg > dhcpcd
changeset 5435:557a3f9f2be4 draft
DHCP: allow leasetime -1 to represent infinity
Easier to enter than 4294967295 seconds which is the real
representation of infinity.
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Wed, 02 Sep 2020 09:56:32 +0100 |
| parents | dead0d841402 |
| children | 56c934c73aa8 |
| files | src/dhcpcd.8.in src/dhcpcd.conf.5.in src/if-options.c |
| diffstat | 3 files changed, 16 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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
--- 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) {
