mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Tidy last two commits.
This commit is contained in:
@@ -1418,13 +1418,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((opt = option_find(mess, sz, OPTION_MUD_URL_V4, 1)))
|
if ((opt = option_find(mess, sz, OPTION_MUD_URL_V4, 1)))
|
||||||
{
|
|
||||||
add_extradata_opt(lease, opt);
|
add_extradata_opt(lease, opt);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
add_extradata_opt(lease, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* DNSMASQ_REQUESTED_OPTIONS */
|
/* DNSMASQ_REQUESTED_OPTIONS */
|
||||||
if ((opt = option_find(mess, sz, OPTION_REQUESTED_OPTIONS, 1)))
|
if ((opt = option_find(mess, sz, OPTION_REQUESTED_OPTIONS, 1)))
|
||||||
|
|||||||
@@ -1879,23 +1879,23 @@ static void update_leases(struct state *state, struct dhcp_context *context, str
|
|||||||
#ifdef HAVE_SCRIPT
|
#ifdef HAVE_SCRIPT
|
||||||
if (daemon->lease_change_command)
|
if (daemon->lease_change_command)
|
||||||
{
|
{
|
||||||
void *class_opt;
|
void *opt;
|
||||||
lease->flags |= LEASE_CHANGED;
|
lease->flags |= LEASE_CHANGED;
|
||||||
free(lease->extradata);
|
free(lease->extradata);
|
||||||
lease->extradata = NULL;
|
lease->extradata = NULL;
|
||||||
lease->extradata_size = lease->extradata_len = 0;
|
lease->extradata_size = lease->extradata_len = 0;
|
||||||
lease->vendorclass_count = 0;
|
lease->vendorclass_count = 0;
|
||||||
|
|
||||||
if ((class_opt = opt6_find(state->packet_options, state->end, OPTION6_VENDOR_CLASS, 4)))
|
if ((opt = opt6_find(state->packet_options, state->end, OPTION6_VENDOR_CLASS, 4)))
|
||||||
{
|
{
|
||||||
void *enc_opt, *enc_end = opt6_ptr(class_opt, opt6_len(class_opt));
|
void *enc_opt, *enc_end = opt6_ptr(opt, opt6_len(opt));
|
||||||
lease->vendorclass_count++;
|
lease->vendorclass_count++;
|
||||||
/* send enterprise number first */
|
/* send enterprise number first */
|
||||||
sprintf(daemon->dhcp_buff2, "%u", opt6_uint(class_opt, 0, 4));
|
sprintf(daemon->dhcp_buff2, "%u", opt6_uint(opt, 0, 4));
|
||||||
lease_add_extradata(lease, (unsigned char *)daemon->dhcp_buff2, strlen(daemon->dhcp_buff2), 0);
|
lease_add_extradata(lease, (unsigned char *)daemon->dhcp_buff2, strlen(daemon->dhcp_buff2), 0);
|
||||||
|
|
||||||
if (opt6_len(class_opt) >= 6)
|
if (opt6_len(opt) >= 6)
|
||||||
for (enc_opt = opt6_ptr(class_opt, 4); enc_opt; enc_opt = opt6_next(enc_opt, enc_end))
|
for (enc_opt = opt6_ptr(opt, 4); enc_opt; enc_opt = opt6_next(enc_opt, enc_end))
|
||||||
{
|
{
|
||||||
lease->vendorclass_count++;
|
lease->vendorclass_count++;
|
||||||
lease_add_extradata(lease, opt6_ptr(enc_opt, 0), opt6_len(enc_opt), 0);
|
lease_add_extradata(lease, opt6_ptr(enc_opt, 0), opt6_len(enc_opt), 0);
|
||||||
@@ -1934,20 +1934,15 @@ static void update_leases(struct state *state, struct dhcp_context *context, str
|
|||||||
|
|
||||||
lease_add_extradata(lease, (unsigned char *)daemon->addrbuff, state->link_address ? strlen(daemon->addrbuff) : 0, 0);
|
lease_add_extradata(lease, (unsigned char *)daemon->addrbuff, state->link_address ? strlen(daemon->addrbuff) : 0, 0);
|
||||||
|
|
||||||
void *mud_opt;
|
if ((opt = opt6_find(state->packet_options, state->end, OPTION6_MUD_URL, 1)))
|
||||||
if ((mud_opt = opt6_find(state->packet_options, state->end, OPTION6_MUD_URL, 1)))
|
lease_add_extradata(lease, opt6_ptr(opt, 0), opt6_len(opt), 0);
|
||||||
{
|
|
||||||
lease_add_extradata(lease, opt6_ptr(mud_opt, 0), opt6_len(mud_opt), NULL);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
lease_add_extradata(lease, NULL, 0, 0);
|
lease_add_extradata(lease, NULL, 0, 0);
|
||||||
}
|
|
||||||
|
|
||||||
if ((class_opt = opt6_find(state->packet_options, state->end, OPTION6_USER_CLASS, 2)))
|
if ((opt = opt6_find(state->packet_options, state->end, OPTION6_USER_CLASS, 2)))
|
||||||
{
|
{
|
||||||
void *enc_opt, *enc_end = opt6_ptr(class_opt, opt6_len(class_opt));
|
void *enc_opt, *enc_end = opt6_ptr(opt, opt6_len(opt));
|
||||||
for (enc_opt = opt6_ptr(class_opt, 0); enc_opt; enc_opt = opt6_next(enc_opt, enc_end))
|
for (enc_opt = opt6_ptr(opt, 0); enc_opt; enc_opt = opt6_next(enc_opt, enc_end))
|
||||||
lease_add_extradata(lease, opt6_ptr(enc_opt, 0), opt6_len(enc_opt), 0);
|
lease_add_extradata(lease, opt6_ptr(enc_opt, 0), opt6_len(enc_opt), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user