diff options
author | Simon Kelley <simon@thekelleys.org.uk> | 2022-07-31 11:33:05 +0100 |
---|---|---|
committer | Simon Kelley <simon@thekelleys.org.uk> | 2022-07-31 11:33:05 +0100 |
commit | 05e6728e9874ab748c4c6629ff869af43533a16d (patch) | |
tree | 1bac85631150d40a8072e4557c192104cc5a2e14 | |
parent | 6578acd668c0231df00135d0007d355466e21bfe (diff) | |
download | dnsmasq-05e6728e9874ab748c4c6629ff869af43533a16d.tar.gz |
Fix bit-rotted data handling code for LUA scripts.
-rw-r--r-- | src/helper.c | 12 | ||||
-rw-r--r-- | src/rfc2131.c | 7 | ||||
-rw-r--r-- | src/rfc3315.c | 10 |
3 files changed, 14 insertions, 15 deletions
diff --git a/src/helper.c b/src/helper.c index 771a3e9..8504aca 100644 --- a/src/helper.c +++ b/src/helper.c @@ -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, "subscriber_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"); 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_SUBSCRIBER_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_MUD_URL", &err); buf = grab_extradata(buf, end, "DNSMASQ_TAGS", &err); - - if (is6) { - buf = grab_extradata(buf, end, "DNSMASQ_RELAY_ADDRESS", &err); - buf = grab_extradata(buf, end, "DNSMASQ_MUD_URL", &err); - } + + if (is6) + buf = grab_extradata(buf, end, "DNSMASQ_RELAY_ADDRESS", &err); else { const char *giaddr = NULL; diff --git a/src/rfc2131.c b/src/rfc2131.c index 0053909..7e7c1a5 100644 --- a/src/rfc2131.c +++ b/src/rfc2131.c @@ -1417,9 +1417,6 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index, add_extradata_opt(lease, NULL); } - if ((opt = option_find(mess, sz, OPTION_MUD_URL_V4, 1))) - add_extradata_opt(lease, opt); - /* DNSMASQ_REQUESTED_OPTIONS */ if ((opt = option_find(mess, sz, OPTION_REQUESTED_OPTIONS, 1))) { @@ -1437,7 +1434,9 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index, { add_extradata_opt(lease, NULL); } - + + add_extradata_opt(lease, option_find(mess, sz, OPTION_MUD_URL_V4, 1)); + /* space-concat tag set */ if (!tagif_netid) add_extradata_opt(lease, NULL); diff --git a/src/rfc3315.c b/src/rfc3315.c index c055718..31260df 100644 --- a/src/rfc3315.c +++ b/src/rfc3315.c @@ -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)); |