mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Pass MUD URLs (RFC 8520) supplied via DHCPv6 to DHCP scripts
Extract Manufacturer Usage Description (MUD) URL from DHCP Option 112 and make it available to DHCP scripts as DNSMASQ_MUD_URL. This expands on the initial support for Manufacturer Usage Description URLs that has been added in the previous commit for DHCPv4 by also supporting MUD URLs supplied using DHCPv6. See https://datatracker.ietf.org/doc/html/rfc8520#section-17.3 and https://datatracker.ietf.org/doc/html/rfc8520#section-10 Co-authored-by: Jasper Wiegratz <wiegratz@uni-bremen.de>
This commit is contained in:
committed by
Simon Kelley
parent
ef6efd69ed
commit
508d6b4885
@@ -63,6 +63,7 @@
|
|||||||
#define OPTION6_FQDN 39
|
#define OPTION6_FQDN 39
|
||||||
#define OPTION6_NTP_SERVER 56
|
#define OPTION6_NTP_SERVER 56
|
||||||
#define OPTION6_CLIENT_MAC 79
|
#define OPTION6_CLIENT_MAC 79
|
||||||
|
#define OPTION6_MUD_URL 112
|
||||||
|
|
||||||
#define NTP_SUBOPTION_SRV_ADDR 1
|
#define NTP_SUBOPTION_SRV_ADDR 1
|
||||||
#define NTP_SUBOPTION_MC_ADDR 2
|
#define NTP_SUBOPTION_MC_ADDR 2
|
||||||
|
|||||||
@@ -638,8 +638,10 @@ int create_helper(int event_fd, int err_fd, uid_t uid, gid_t gid, long max_fd)
|
|||||||
|
|
||||||
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;
|
||||||
|
|||||||
@@ -1934,6 +1934,16 @@ 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 ((mud_opt = opt6_find(state->packet_options, state->end, OPTION6_MUD_URL, 1)))
|
||||||
|
{
|
||||||
|
lease_add_extradata(lease, opt6_ptr(mud_opt, 0), opt6_len(mud_opt), NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lease_add_extradata(lease, NULL, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if ((class_opt = opt6_find(state->packet_options, state->end, OPTION6_USER_CLASS, 2)))
|
if ((class_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(class_opt, opt6_len(class_opt));
|
||||||
|
|||||||
Reference in New Issue
Block a user