mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Add --script-on-renewal option.
This commit is contained in:
@@ -86,6 +86,8 @@ version 2.81
|
||||
Remove DSA signature verification from DNSSEC, as specified in
|
||||
RFC 8624. Thanks to Loganaden Velvindron for the original patch.
|
||||
|
||||
Add --script-on-renewal option.
|
||||
|
||||
|
||||
version 2.80
|
||||
Add support for RFC 4039 DHCP rapid commit. Thanks to Ashram Method
|
||||
|
||||
@@ -1554,7 +1554,8 @@ address of the host (or DUID for IPv6) , the IP address, and the hostname,
|
||||
if known. "add" means a lease has been created, "del" means it has
|
||||
been destroyed, "old" is a notification of an existing lease when
|
||||
dnsmasq starts or a change to MAC address or hostname of an existing
|
||||
lease (also, lease length or expiry and client-id, if \fB--leasefile-ro\fP is set).
|
||||
lease (also, lease length or expiry and client-id, if \fB--leasefile-ro\fP is set
|
||||
and lease expiry if \fB--script-on-renewal\fP is set).
|
||||
If the MAC address is from a network type other than ethernet,
|
||||
it will have the network type prepended, eg "06-01:23:45:67:89:ab" for
|
||||
token ring. The process is run as root (assuming that dnsmasq was originally run as
|
||||
@@ -1744,6 +1745,10 @@ stdout and exit with zero exit code. Setting this
|
||||
option also forces the leasechange script to be called on changes
|
||||
to the client-id and lease length and expiry time.
|
||||
.TP
|
||||
.B --script-on-renewal
|
||||
Call the dhcp script when the lease expiry time changes, for instance when the
|
||||
lease is renewed.
|
||||
.TP
|
||||
.B --bridge-interface=<interface>,<alias>[,<alias>]
|
||||
Treat DHCP (v4 and v6) requests and IPv6 Router Solicit packets
|
||||
arriving at any of the <alias> interfaces as if they had arrived at
|
||||
|
||||
@@ -267,7 +267,8 @@ struct event_desc {
|
||||
#define OPT_UBUS 58
|
||||
#define OPT_IGNORE_CLID 59
|
||||
#define OPT_SINGLE_PORT 60
|
||||
#define OPT_LAST 61
|
||||
#define OPT_LEASE_RENEW 61
|
||||
#define OPT_LAST 62
|
||||
|
||||
#define OPTION_BITS (sizeof(unsigned int)*8)
|
||||
#define OPTION_SIZE ( (OPT_LAST/OPTION_BITS)+((OPT_LAST%OPTION_BITS)!=0) )
|
||||
@@ -482,7 +483,7 @@ struct crec {
|
||||
#define F_NO_RR (1u<<25)
|
||||
#define F_IPSET (1u<<26)
|
||||
#define F_NOEXTRA (1u<<27)
|
||||
#define F_SERVFAIL (1u<<28)
|
||||
#define F_SERVFAIL (1u<<28) /* currently unused. */
|
||||
#define F_RCODE (1u<<29)
|
||||
#define F_SRV (1u<<30)
|
||||
|
||||
@@ -703,6 +704,7 @@ struct frec {
|
||||
#define LEASE_NA 32 /* IPv6 no-temporary lease */
|
||||
#define LEASE_TA 64 /* IPv6 temporary lease */
|
||||
#define LEASE_HAVE_HWADDR 128 /* Have set hwaddress */
|
||||
#define LEASE_EXP_CHANGED 256 /* Lease expiry time changed */
|
||||
|
||||
struct dhcp_lease {
|
||||
int clid_len; /* length of client identifier */
|
||||
|
||||
@@ -836,7 +836,7 @@ void lease_set_expires(struct dhcp_lease *lease, unsigned int len, time_t now)
|
||||
dns_dirty = 1;
|
||||
lease->expires = exp;
|
||||
#ifndef HAVE_BROKEN_RTC
|
||||
lease->flags |= LEASE_AUX_CHANGED;
|
||||
lease->flags |= LEASE_AUX_CHANGED | LEASE_EXP_CHANGED;
|
||||
file_dirty = 1;
|
||||
#endif
|
||||
}
|
||||
@@ -1136,7 +1136,8 @@ int do_script_run(time_t now)
|
||||
|
||||
for (lease = leases; lease; lease = lease->next)
|
||||
if ((lease->flags & (LEASE_NEW | LEASE_CHANGED)) ||
|
||||
((lease->flags & LEASE_AUX_CHANGED) && option_bool(OPT_LEASE_RO)))
|
||||
((lease->flags & LEASE_AUX_CHANGED) && option_bool(OPT_LEASE_RO)) ||
|
||||
((lease->flags & LEASE_EXP_CHANGED) && option_bool(OPT_LEASE_RENEW)))
|
||||
{
|
||||
#ifdef HAVE_SCRIPT
|
||||
queue_script((lease->flags & LEASE_NEW) ? ACTION_ADD : ACTION_OLD, lease,
|
||||
@@ -1146,7 +1147,7 @@ int do_script_run(time_t now)
|
||||
emit_dbus_signal((lease->flags & LEASE_NEW) ? ACTION_ADD : ACTION_OLD, lease,
|
||||
lease->fqdn ? lease->fqdn : lease->hostname);
|
||||
#endif
|
||||
lease->flags &= ~(LEASE_NEW | LEASE_CHANGED | LEASE_AUX_CHANGED);
|
||||
lease->flags &= ~(LEASE_NEW | LEASE_CHANGED | LEASE_AUX_CHANGED | LEASE_EXP_CHANGED);
|
||||
|
||||
/* this is used for the "add" call, then junked, since they're not in the database */
|
||||
free(lease->extradata);
|
||||
|
||||
@@ -166,6 +166,7 @@ struct myoption {
|
||||
#define LOPT_SHARED_NET 357
|
||||
#define LOPT_IGNORE_CLID 358
|
||||
#define LOPT_SINGLE_PORT 359
|
||||
#define LOPT_SCRIPT_TIME 360
|
||||
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
static const struct option opts[] =
|
||||
@@ -245,6 +246,7 @@ static const struct myoption opts[] =
|
||||
{ "conf-dir", 1, 0, '7' },
|
||||
{ "log-facility", 1, 0 ,'8' },
|
||||
{ "leasefile-ro", 0, 0, '9' },
|
||||
{ "script-on-renewal", 0, 0, LOPT_SCRIPT_TIME},
|
||||
{ "dns-forward-max", 1, 0, '0' },
|
||||
{ "clear-on-reload", 0, 0, LOPT_RELOAD },
|
||||
{ "dhcp-ignore-names", 2, 0, LOPT_NO_NAMES },
|
||||
@@ -515,6 +517,7 @@ static struct {
|
||||
{ LOPT_RAPID_COMMIT, OPT_RAPID_COMMIT, NULL, gettext_noop("Enables DHCPv4 Rapid Commit option."), NULL },
|
||||
{ LOPT_DUMPFILE, ARG_ONE, "<path>", gettext_noop("Path to debug packet dump file"), NULL },
|
||||
{ LOPT_DUMPMASK, ARG_ONE, "<hex>", gettext_noop("Mask which packets to dump"), NULL },
|
||||
{ LOPT_SCRIPT_TIME, OPT_LEASE_RENEW, NULL, gettext_noop("Call dhcp-script when lease expiry changes."), NULL },
|
||||
{ 0, 0, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user