mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Update man page on DHCP data provided to scripts. Provide requested options for DHCPv6 also.
This commit is contained in:
@@ -1743,6 +1743,11 @@ DNSMASQ_LOG_DHCP is set if
|
||||
.B --log-dhcp
|
||||
is in effect.
|
||||
|
||||
DNSMASQ_REQUESTED_OPTIONS a string containing the decimal values in the Parameter Request List option, comma separated, if the parameter request list option is provided by the client.
|
||||
|
||||
DNSMASQ_MUD_URL the Manufacturer Usage Description URL if provided by the client. (See RFC8520 for details.)
|
||||
|
||||
|
||||
For IPv4 only:
|
||||
|
||||
DNSMASQ_CLIENT_ID if the host provided a client-id.
|
||||
@@ -1752,8 +1757,6 @@ DHCP relay-agent added any of these options.
|
||||
|
||||
If the client provides vendor-class, DNSMASQ_VENDOR_CLASS.
|
||||
|
||||
DNSMASQ_REQUESTED_OPTIONS a string containing the decimal values in the Parameter Request List option, comma separated, if the parameter request list option is provided by the client.
|
||||
|
||||
For IPv6 only:
|
||||
|
||||
If the client provides vendor-class, DNSMASQ_VENDOR_CLASS_ID,
|
||||
|
||||
@@ -450,9 +450,9 @@ 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, "requested_options");
|
||||
buf = grab_extradata_lua(buf, end, "mud_url");
|
||||
buf = grab_extradata_lua(buf, end, "tags");
|
||||
|
||||
@@ -635,9 +635,9 @@ 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_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);
|
||||
|
||||
|
||||
@@ -1420,20 +1420,15 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index,
|
||||
/* DNSMASQ_REQUESTED_OPTIONS */
|
||||
if ((opt = option_find(mess, sz, OPTION_REQUESTED_OPTIONS, 1)))
|
||||
{
|
||||
int len = option_len(opt);
|
||||
int i, len = option_len(opt);
|
||||
unsigned char *rop = option_ptr(opt, 0);
|
||||
char *q = daemon->namebuff;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
q += snprintf(q, MAXDNAME - (q - daemon->namebuff), "%d%s", rop[i], i + 1 == len ? "" : ",");
|
||||
}
|
||||
lease_add_extradata(lease, (unsigned char *)daemon->namebuff, (q - daemon->namebuff), 0);
|
||||
lease_add_extradata(lease, (unsigned char *)daemon->namebuff,
|
||||
sprintf(daemon->namebuff, "%u", rop[i]), (i + 1) == len ? 0 : ',');
|
||||
}
|
||||
else
|
||||
{
|
||||
add_extradata_opt(lease, NULL);
|
||||
}
|
||||
lease_add_extradata(lease, NULL, 0, 0);
|
||||
|
||||
add_extradata_opt(lease, option_find(mess, sz, OPTION_MUD_URL_V4, 1));
|
||||
|
||||
|
||||
@@ -1880,6 +1880,7 @@ static void update_leases(struct state *state, struct dhcp_context *context, str
|
||||
if (daemon->lease_change_command)
|
||||
{
|
||||
void *opt;
|
||||
|
||||
lease->flags |= LEASE_CHANGED;
|
||||
free(lease->extradata);
|
||||
lease->extradata = NULL;
|
||||
@@ -1905,6 +1906,19 @@ 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);
|
||||
|
||||
/* DNSMASQ_REQUESTED_OPTIONS */
|
||||
if ((opt = opt6_find(state->packet_options, state->end, OPTION6_ORO, 2)))
|
||||
{
|
||||
int i, len = opt6_len(opt)/2;
|
||||
u16 *rop = opt6_ptr(opt, 0);
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
lease_add_extradata(lease, (unsigned char *)daemon->namebuff,
|
||||
sprintf(daemon->namebuff, "%u", ntohs(rop[i])), (i + 1) == len ? 0 : ',');
|
||||
}
|
||||
else
|
||||
lease_add_extradata(lease, NULL, 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
|
||||
|
||||
Reference in New Issue
Block a user