diff --git a/sdhcp.c b/sdhcp.c index 1fcf5e6..21e6372 100644 --- a/sdhcp.c +++ b/sdhcp.c @@ -434,12 +434,13 @@ Bound: optget(&bp, mask, OBmask, sizeof(mask)); optget(&bp, router, OBrouter, sizeof(router)); optget(&bp, dns, OBdnsserver, sizeof(dns)); - optget(&bp, &renewaltime, ODrenewaltime, sizeof(renewaltime)); - optget(&bp, &rebindingtime, ODrebindingtime, sizeof(rebindingtime)); optget(&bp, &lease, ODlease, sizeof(lease)); - renewaltime = ntohl(renewaltime); - rebindingtime = ntohl(rebindingtime); lease = ntohl(lease); + /* Renew and rebind times are optional. It is faster to just + * calculate the times. Assumes: lease > 4s and < ~20 years. + */ + renewaltime = lease / 2; + rebindingtime = lease * 7 / 8; acceptlease(); fputs("Congrats! You should be on the 'net.\n", stdout); if (!fflag && !forked) {