]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
DHCP: allow leasetime -1 to represent infinity
authorRoy Marples <roy@marples.name>
Wed, 2 Sep 2020 08:56:32 +0000 (09:56 +0100)
committerRoy Marples <roy@marples.name>
Wed, 2 Sep 2020 08:56:32 +0000 (09:56 +0100)
Easier to enter than 4294967295 seconds which is the real
representation of infinity.

src/dhcpcd.8.in
src/dhcpcd.conf.5.in
src/if-options.c

index 8704e2454389b3150d36bfdaa68ca07bcbca0520..9309250aa4814a69110ae6da83baa8f89617a7e8 100644 (file)
@@ -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 @@ If no interfaces are left running,
 .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
index 071bef49d12c26fd7e61f85a8b2ac8b11c917234..998f99e92bbd518fb9ed60c01a87aed7bfece242 100644 (file)
@@ -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 @@ Enables IPv6 Router Advertisement solicitation.
 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
index 9ea629ae67934161143d040aad2747d4d7dbbeb6..213d05cc186b8265c54c390ee486a25492ab36dc 100644 (file)
@@ -761,6 +761,10 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
                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) {