Fix bit-rotted data handling code for LUA scripts.

This commit is contained in:
Simon Kelley
2022-07-31 11:33:05 +01:00
parent 6578acd668
commit 05e6728e98
3 changed files with 14 additions and 15 deletions

View File

@@ -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,
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 */
if (!tagif && !context->netid.net)
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);
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)))
{
void *enc_opt, *enc_end = opt6_ptr(opt, opt6_len(opt));