mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Fix bit-rotted data handling code for LUA scripts.
This commit is contained in:
@@ -450,8 +450,10 @@ int create_helper(int event_fd, int err_fd, uid_t uid, gid_t gid, long max_fd)
|
|||||||
buf = grab_extradata_lua(buf, end, "circuit_id");
|
buf = grab_extradata_lua(buf, end, "circuit_id");
|
||||||
buf = grab_extradata_lua(buf, end, "subscriber_id");
|
buf = grab_extradata_lua(buf, end, "subscriber_id");
|
||||||
buf = grab_extradata_lua(buf, end, "remote_id");
|
buf = grab_extradata_lua(buf, end, "remote_id");
|
||||||
|
buf = grab_extradata_lua(buf, end, "requested_options");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buf = grab_extradata_lua(buf, end, "mud_url");
|
||||||
buf = grab_extradata_lua(buf, end, "tags");
|
buf = grab_extradata_lua(buf, end, "tags");
|
||||||
|
|
||||||
if (is6)
|
if (is6)
|
||||||
@@ -633,16 +635,14 @@ int create_helper(int event_fd, int err_fd, uid_t uid, gid_t gid, long max_fd)
|
|||||||
buf = grab_extradata(buf, end, "DNSMASQ_CIRCUIT_ID", &err);
|
buf = grab_extradata(buf, end, "DNSMASQ_CIRCUIT_ID", &err);
|
||||||
buf = grab_extradata(buf, end, "DNSMASQ_SUBSCRIBER_ID", &err);
|
buf = grab_extradata(buf, end, "DNSMASQ_SUBSCRIBER_ID", &err);
|
||||||
buf = grab_extradata(buf, end, "DNSMASQ_REMOTE_ID", &err);
|
buf = grab_extradata(buf, end, "DNSMASQ_REMOTE_ID", &err);
|
||||||
buf = grab_extradata(buf, end, "DNSMASQ_MUD_URL", &err);
|
|
||||||
buf = grab_extradata(buf, end, "DNSMASQ_REQUESTED_OPTIONS", &err);
|
buf = grab_extradata(buf, end, "DNSMASQ_REQUESTED_OPTIONS", &err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buf = grab_extradata(buf, end, "DNSMASQ_MUD_URL", &err);
|
||||||
buf = grab_extradata(buf, end, "DNSMASQ_TAGS", &err);
|
buf = grab_extradata(buf, end, "DNSMASQ_TAGS", &err);
|
||||||
|
|
||||||
if (is6) {
|
if (is6)
|
||||||
buf = grab_extradata(buf, end, "DNSMASQ_RELAY_ADDRESS", &err);
|
buf = grab_extradata(buf, end, "DNSMASQ_RELAY_ADDRESS", &err);
|
||||||
buf = grab_extradata(buf, end, "DNSMASQ_MUD_URL", &err);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char *giaddr = NULL;
|
const char *giaddr = NULL;
|
||||||
|
|||||||
@@ -1417,9 +1417,6 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
add_extradata_opt(lease, NULL);
|
add_extradata_opt(lease, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((opt = option_find(mess, sz, OPTION_MUD_URL_V4, 1)))
|
|
||||||
add_extradata_opt(lease, opt);
|
|
||||||
|
|
||||||
/* 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)))
|
||||||
{
|
{
|
||||||
@@ -1438,6 +1435,8 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
|||||||
add_extradata_opt(lease, NULL);
|
add_extradata_opt(lease, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_extradata_opt(lease, option_find(mess, sz, OPTION_MUD_URL_V4, 1));
|
||||||
|
|
||||||
/* space-concat tag set */
|
/* space-concat tag set */
|
||||||
if (!tagif_netid)
|
if (!tagif_netid)
|
||||||
add_extradata_opt(lease, NULL);
|
add_extradata_opt(lease, NULL);
|
||||||
|
|||||||
@@ -1905,6 +1905,11 @@ static void update_leases(struct state *state, struct dhcp_context *context, str
|
|||||||
lease_add_extradata(lease, (unsigned char *)state->client_hostname,
|
lease_add_extradata(lease, (unsigned char *)state->client_hostname,
|
||||||
state->client_hostname ? strlen(state->client_hostname) : 0, 0);
|
state->client_hostname ? strlen(state->client_hostname) : 0, 0);
|
||||||
|
|
||||||
|
if ((opt = opt6_find(state->packet_options, state->end, OPTION6_MUD_URL, 1)))
|
||||||
|
lease_add_extradata(lease, opt6_ptr(opt, 0), opt6_len(opt), 0);
|
||||||
|
else
|
||||||
|
lease_add_extradata(lease, NULL, 0, 0);
|
||||||
|
|
||||||
/* space-concat tag set */
|
/* space-concat tag set */
|
||||||
if (!tagif && !context->netid.net)
|
if (!tagif && !context->netid.net)
|
||||||
lease_add_extradata(lease, NULL, 0, 0);
|
lease_add_extradata(lease, NULL, 0, 0);
|
||||||
@@ -1934,11 +1939,6 @@ 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);
|
||||||
|
|
||||||
if ((opt = opt6_find(state->packet_options, state->end, OPTION6_MUD_URL, 1)))
|
|
||||||
lease_add_extradata(lease, opt6_ptr(opt, 0), opt6_len(opt), 0);
|
|
||||||
else
|
|
||||||
lease_add_extradata(lease, NULL, 0, 0);
|
|
||||||
|
|
||||||
if ((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(opt, opt6_len(opt));
|
void *enc_opt, *enc_end = opt6_ptr(opt, opt6_len(opt));
|
||||||
|
|||||||
Reference in New Issue
Block a user