mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-20 02:38:32 +00:00
Change default lease time for DHCPv6 to one day.
Also remove floor on valid and preffered times in RA when no time is specified.
This commit is contained in:
@@ -10,6 +10,14 @@ version 2.82
|
|||||||
Fix crash under heavy TCP connection load introdcued in 2.81.
|
Fix crash under heavy TCP connection load introdcued in 2.81.
|
||||||
Thanks to Frank for good work chasing this down.
|
Thanks to Frank for good work chasing this down.
|
||||||
|
|
||||||
|
Change default lease time for DHCPv6 to one day.
|
||||||
|
|
||||||
|
Alter calculation of preffered and valid times in router
|
||||||
|
advertisements, so that these do not have a floor applied
|
||||||
|
of the lease time in the dhcp-range if this is not explicitly
|
||||||
|
specified and is merely the default.
|
||||||
|
Thanks to Martin-Éric Racine for suggestions on this.
|
||||||
|
|
||||||
|
|
||||||
version 2.81
|
version 2.81
|
||||||
Improve cache behaviour for TCP connections. For ease of
|
Improve cache behaviour for TCP connections. For ease of
|
||||||
|
|||||||
@@ -861,7 +861,7 @@ in
|
|||||||
options. If the lease time is given, then leases
|
options. If the lease time is given, then leases
|
||||||
will be given for that length of time. The lease time is in seconds,
|
will be given for that length of time. The lease time is in seconds,
|
||||||
or minutes (eg 45m) or hours (eg 1h) or "infinite". If not given,
|
or minutes (eg 45m) or hours (eg 1h) or "infinite". If not given,
|
||||||
the default lease time is one hour. The
|
the default lease time is one hour for IPv4 and one day for IPv6. The
|
||||||
minimum lease time is two minutes. For IPv6 ranges, the lease time
|
minimum lease time is two minutes. For IPv6 ranges, the lease time
|
||||||
maybe "deprecated"; this sets the preferred lifetime sent in a DHCP
|
maybe "deprecated"; this sets the preferred lifetime sent in a DHCP
|
||||||
lease or router advertisement to zero, which causes clients to use
|
lease or router advertisement to zero, which causes clients to use
|
||||||
|
|||||||
@@ -43,7 +43,8 @@
|
|||||||
#define DNSSEC_MIN_TTL 60 /* DNSKEY and DS records in cache last at least this long */
|
#define DNSSEC_MIN_TTL 60 /* DNSKEY and DS records in cache last at least this long */
|
||||||
#define HOSTSFILE "/etc/hosts"
|
#define HOSTSFILE "/etc/hosts"
|
||||||
#define ETHERSFILE "/etc/ethers"
|
#define ETHERSFILE "/etc/ethers"
|
||||||
#define DEFLEASE 3600 /* default lease time, 1 hour */
|
#define DEFLEASE 3600 /* default DHCPv4 lease time, one hour */
|
||||||
|
#define DEFLEASE6 (3600*24) /* default lease time for DHCPv6. One day. */
|
||||||
#define CHUSER "nobody"
|
#define CHUSER "nobody"
|
||||||
#define CHGRP "dip"
|
#define CHGRP "dip"
|
||||||
#define TFTP_MAX_CONNECTIONS 50 /* max simultaneous connections */
|
#define TFTP_MAX_CONNECTIONS 50 /* max simultaneous connections */
|
||||||
|
|||||||
@@ -942,6 +942,7 @@ struct shared_network {
|
|||||||
#define CONTEXT_OLD (1u<<16)
|
#define CONTEXT_OLD (1u<<16)
|
||||||
#define CONTEXT_V6 (1u<<17)
|
#define CONTEXT_V6 (1u<<17)
|
||||||
#define CONTEXT_RA_OFF_LINK (1u<<18)
|
#define CONTEXT_RA_OFF_LINK (1u<<18)
|
||||||
|
#define CONTEXT_SETLEASE (1u<<19)
|
||||||
|
|
||||||
struct ping_result {
|
struct ping_result {
|
||||||
struct in_addr addr;
|
struct in_addr addr;
|
||||||
|
|||||||
@@ -2991,7 +2991,6 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
struct dhcp_context *new = opt_malloc(sizeof(struct dhcp_context));
|
struct dhcp_context *new = opt_malloc(sizeof(struct dhcp_context));
|
||||||
|
|
||||||
memset (new, 0, sizeof(*new));
|
memset (new, 0, sizeof(*new));
|
||||||
new->lease_time = DEFLEASE;
|
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
@@ -3041,6 +3040,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
if (inet_pton(AF_INET, a[0], &new->start))
|
if (inet_pton(AF_INET, a[0], &new->start))
|
||||||
{
|
{
|
||||||
new->next = daemon->dhcp;
|
new->next = daemon->dhcp;
|
||||||
|
new->lease_time = DEFLEASE;
|
||||||
daemon->dhcp = new;
|
daemon->dhcp = new;
|
||||||
new->end = new->start;
|
new->end = new->start;
|
||||||
if (strcmp(a[1], "static") == 0)
|
if (strcmp(a[1], "static") == 0)
|
||||||
@@ -3088,6 +3088,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
new->flags |= CONTEXT_V6;
|
new->flags |= CONTEXT_V6;
|
||||||
new->prefix = 64; /* default */
|
new->prefix = 64; /* default */
|
||||||
new->end6 = new->start6;
|
new->end6 = new->start6;
|
||||||
|
new->lease_time = DEFLEASE6;
|
||||||
new->next = daemon->dhcp6;
|
new->next = daemon->dhcp6;
|
||||||
daemon->dhcp6 = new;
|
daemon->dhcp6 = new;
|
||||||
|
|
||||||
@@ -3187,7 +3188,10 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(a[leasepos], "infinite") == 0)
|
if (strcmp(a[leasepos], "infinite") == 0)
|
||||||
|
{
|
||||||
new->lease_time = 0xffffffff;
|
new->lease_time = 0xffffffff;
|
||||||
|
new->flags |= CONTEXT_SETLEASE;
|
||||||
|
}
|
||||||
else if (strcmp(a[leasepos], "deprecated") == 0)
|
else if (strcmp(a[leasepos], "deprecated") == 0)
|
||||||
new->flags |= CONTEXT_DEPRECATE;
|
new->flags |= CONTEXT_DEPRECATE;
|
||||||
else
|
else
|
||||||
@@ -3226,6 +3230,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
ret_err_free(_("bad dhcp-range"), new);
|
ret_err_free(_("bad dhcp-range"), new);
|
||||||
|
|
||||||
new->lease_time = atoi(a[leasepos]) * fac;
|
new->lease_time = atoi(a[leasepos]) * fac;
|
||||||
|
new->flags |= CONTEXT_SETLEASE;
|
||||||
/* Leases of a minute or less confuse
|
/* Leases of a minute or less confuse
|
||||||
some clients, notably Apple's */
|
some clients, notably Apple's */
|
||||||
if (new->lease_time < 120)
|
if (new->lease_time < 120)
|
||||||
@@ -3233,6 +3238,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -626,8 +626,11 @@ static int add_prefixes(struct in6_addr *local, int prefix,
|
|||||||
real_prefix = context->prefix;
|
real_prefix = context->prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find floor time, don't reduce below 3 * RA interval. */
|
/* find floor time, don't reduce below 3 * RA interval.
|
||||||
if (time > context->lease_time)
|
If the lease time has been left as default, don't
|
||||||
|
use that as a floor. */
|
||||||
|
if ((context->flags & CONTEXT_SETLEASE) &&
|
||||||
|
time > context->lease_time)
|
||||||
{
|
{
|
||||||
time = context->lease_time;
|
time = context->lease_time;
|
||||||
if (time < ((unsigned int)(3 * param->adv_interval)))
|
if (time < ((unsigned int)(3 * param->adv_interval)))
|
||||||
|
|||||||
Reference in New Issue
Block a user