Add DNSMASQ_DATA_MISSING envvar to lease-change script.

This commit is contained in:
Simon Kelley
2022-03-22 13:47:05 +00:00
parent 756a1dcc19
commit 191924576c
2 changed files with 13 additions and 1 deletions

View File

@@ -1714,6 +1714,12 @@ DNSMASQ_LEASE_LENGTH, otherwise the time of lease expiry is stored in
DNSMASQ_LEASE_EXPIRES. The number of seconds until lease expiry is DNSMASQ_LEASE_EXPIRES. The number of seconds until lease expiry is
always stored in DNSMASQ_TIME_REMAINING. always stored in DNSMASQ_TIME_REMAINING.
DNSMASQ_DATA_MISSING is set to "1" during "old" events for existing
leases generated at startup to indicate that data not stored in the
persistent lease database will not be present. This comprises everything
other than IP address, hostname, MAC address, DUID, IAID and lease length
or expiry time.
If a lease used to have a hostname, which is If a lease used to have a hostname, which is
removed, an "old" event is generated with the new state of the lease, removed, an "old" event is generated with the new state of the lease,
ie no name, and the former name is provided in the environment ie no name, and the former name is provided in the environment

View File

@@ -422,6 +422,9 @@ int create_helper(int event_fd, int err_fd, uid_t uid, gid_t gid, long max_fd)
end = extradata + data.ed_len; end = extradata + data.ed_len;
buf = extradata; buf = extradata;
lua_pushnumber(lua, data.ed_len == 0 ? 1 : 0);
lua_setfield(lua, -2, "data_missing");
if (!is6) if (!is6)
buf = grab_extradata_lua(buf, end, "vendor_class"); buf = grab_extradata_lua(buf, end, "vendor_class");
#ifdef HAVE_DHCP6 #ifdef HAVE_DHCP6
@@ -600,6 +603,9 @@ int create_helper(int event_fd, int err_fd, uid_t uid, gid_t gid, long max_fd)
end = extradata + data.ed_len; end = extradata + data.ed_len;
buf = extradata; buf = extradata;
if (data.ed_len == 0)
my_setenv("DNSMASQ_DATA_MISSING", "1", &err);
if (!is6) if (!is6)
buf = grab_extradata(buf, end, "DNSMASQ_VENDOR_CLASS", &err); buf = grab_extradata(buf, end, "DNSMASQ_VENDOR_CLASS", &err);
#ifdef HAVE_DHCP6 #ifdef HAVE_DHCP6