mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Ensure that the DBus DhcpLeaseUpdated events are generated.
This commit is contained in:
@@ -95,6 +95,11 @@ version 2.61
|
|||||||
|
|
||||||
Add --tftp-lowercase option. Thanks to Oliver Rath for the
|
Add --tftp-lowercase option. Thanks to Oliver Rath for the
|
||||||
patch.
|
patch.
|
||||||
|
|
||||||
|
Ensure that the DBus DhcpLeaseUpdated events are generated
|
||||||
|
when a lease goes through INIT_REBOOT state, even if the
|
||||||
|
dhcp-script is not in use. thanks to Antoaneta-Ecaterina
|
||||||
|
Ene for the patch.
|
||||||
|
|
||||||
|
|
||||||
version 2.60
|
version 2.60
|
||||||
|
|||||||
@@ -1222,51 +1222,56 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
|
|
||||||
log_tags(tagif_netid, ntohl(mess->xid));
|
log_tags(tagif_netid, ntohl(mess->xid));
|
||||||
|
|
||||||
#ifdef HAVE_SCRIPT
|
if (do_classes)
|
||||||
if (do_classes && daemon->lease_change_command)
|
|
||||||
{
|
{
|
||||||
struct dhcp_netid *n;
|
/* pick up INIT-REBOOT events. */
|
||||||
|
|
||||||
if (mess->giaddr.s_addr)
|
|
||||||
lease->giaddr = mess->giaddr;
|
|
||||||
|
|
||||||
lease->flags |= LEASE_CHANGED;
|
lease->flags |= LEASE_CHANGED;
|
||||||
free(lease->extradata);
|
|
||||||
lease->extradata = NULL;
|
|
||||||
lease->extradata_size = lease->extradata_len = 0;
|
|
||||||
|
|
||||||
add_extradata_opt(lease, option_find(mess, sz, OPTION_VENDOR_ID, 1));
|
|
||||||
add_extradata_opt(lease, option_find(mess, sz, OPTION_HOSTNAME, 1));
|
|
||||||
add_extradata_opt(lease, oui);
|
|
||||||
add_extradata_opt(lease, serial);
|
|
||||||
add_extradata_opt(lease, class);
|
|
||||||
|
|
||||||
/* space-concat tag set */
|
|
||||||
if (!tagif_netid)
|
|
||||||
add_extradata_opt(lease, NULL);
|
|
||||||
else
|
|
||||||
for (n = tagif_netid; n; n = n->next)
|
|
||||||
{
|
|
||||||
struct dhcp_netid *n1;
|
|
||||||
/* kill dupes */
|
|
||||||
for (n1 = n->next; n1; n1 = n1->next)
|
|
||||||
if (strcmp(n->net, n1->net) == 0)
|
|
||||||
break;
|
|
||||||
if (!n1)
|
|
||||||
lease_add_extradata(lease, (unsigned char *)n->net, strlen(n->net), n->next ? ' ' : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((opt = option_find(mess, sz, OPTION_USER_CLASS, 1)))
|
#ifdef HAVE_SCRIPT
|
||||||
|
if (daemon->lease_change_command)
|
||||||
{
|
{
|
||||||
int len = option_len(opt);
|
struct dhcp_netid *n;
|
||||||
unsigned char *ucp = option_ptr(opt, 0);
|
|
||||||
/* If the user-class option started as counted strings, the first byte will be zero. */
|
if (mess->giaddr.s_addr)
|
||||||
if (len != 0 && ucp[0] == 0)
|
lease->giaddr = mess->giaddr;
|
||||||
ucp++, len--;
|
|
||||||
lease_add_extradata(lease, ucp, len, 0);
|
free(lease->extradata);
|
||||||
|
lease->extradata = NULL;
|
||||||
|
lease->extradata_size = lease->extradata_len = 0;
|
||||||
|
|
||||||
|
add_extradata_opt(lease, option_find(mess, sz, OPTION_VENDOR_ID, 1));
|
||||||
|
add_extradata_opt(lease, option_find(mess, sz, OPTION_HOSTNAME, 1));
|
||||||
|
add_extradata_opt(lease, oui);
|
||||||
|
add_extradata_opt(lease, serial);
|
||||||
|
add_extradata_opt(lease, class);
|
||||||
|
|
||||||
|
/* space-concat tag set */
|
||||||
|
if (!tagif_netid)
|
||||||
|
add_extradata_opt(lease, NULL);
|
||||||
|
else
|
||||||
|
for (n = tagif_netid; n; n = n->next)
|
||||||
|
{
|
||||||
|
struct dhcp_netid *n1;
|
||||||
|
/* kill dupes */
|
||||||
|
for (n1 = n->next; n1; n1 = n1->next)
|
||||||
|
if (strcmp(n->net, n1->net) == 0)
|
||||||
|
break;
|
||||||
|
if (!n1)
|
||||||
|
lease_add_extradata(lease, (unsigned char *)n->net, strlen(n->net), n->next ? ' ' : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((opt = option_find(mess, sz, OPTION_USER_CLASS, 1)))
|
||||||
|
{
|
||||||
|
int len = option_len(opt);
|
||||||
|
unsigned char *ucp = option_ptr(opt, 0);
|
||||||
|
/* If the user-class option started as counted strings, the first byte will be zero. */
|
||||||
|
if (len != 0 && ucp[0] == 0)
|
||||||
|
ucp++, len--;
|
||||||
|
lease_add_extradata(lease, ucp, len, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if (!hostname_auth && (client_hostname = host_from_dns(mess->yiaddr)))
|
if (!hostname_auth && (client_hostname = host_from_dns(mess->yiaddr)))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user