mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
->hwaddr_len must be zero always in DHCPv6 leases.
This commit is contained in:
@@ -543,6 +543,7 @@ struct dhcp_lease {
|
|||||||
int backoff; /* zero -> confirmed */
|
int backoff; /* zero -> confirmed */
|
||||||
struct slaac_address *next;
|
struct slaac_address *next;
|
||||||
} *slaac_address;
|
} *slaac_address;
|
||||||
|
int vendorclass_count;
|
||||||
#endif
|
#endif
|
||||||
struct dhcp_lease *next;
|
struct dhcp_lease *next;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -655,8 +655,9 @@ void queue_script(int action, struct dhcp_lease *lease, char *hostname, time_t n
|
|||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
unsigned int hostname_len = 0, clid_len = 0, ed_len = 0;
|
unsigned int hostname_len = 0, clid_len = 0, ed_len = 0;
|
||||||
int fd = daemon->dhcpfd;
|
int fd = daemon->dhcpfd;
|
||||||
|
|
||||||
#ifdef HAVE_DHCP6
|
#ifdef HAVE_DHCP6
|
||||||
|
int is6 = !!(lease->flags & (LEASE_TA | LEASE_NA));
|
||||||
|
|
||||||
if (!daemon->dhcp)
|
if (!daemon->dhcp)
|
||||||
fd = daemon->dhcp6fd;
|
fd = daemon->dhcp6fd;
|
||||||
#endif
|
#endif
|
||||||
@@ -676,6 +677,11 @@ void queue_script(int action, struct dhcp_lease *lease, char *hostname, time_t n
|
|||||||
|
|
||||||
buf->action = action;
|
buf->action = action;
|
||||||
buf->flags = lease->flags;
|
buf->flags = lease->flags;
|
||||||
|
#ifdef HAVE_DHCP6
|
||||||
|
if (is6)
|
||||||
|
buf->hwaddr_len = lease->vendorclass_count;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
buf->hwaddr_len = lease->hwaddr_len;
|
buf->hwaddr_len = lease->hwaddr_len;
|
||||||
buf->hwaddr_type = lease->hwaddr_type;
|
buf->hwaddr_type = lease->hwaddr_type;
|
||||||
buf->clid_len = clid_len;
|
buf->clid_len = clid_len;
|
||||||
|
|||||||
@@ -1609,12 +1609,12 @@ static void update_leases(struct state *state, struct dhcp_context *context, str
|
|||||||
free(lease->extradata);
|
free(lease->extradata);
|
||||||
lease->extradata = NULL;
|
lease->extradata = NULL;
|
||||||
lease->extradata_size = lease->extradata_len = 0;
|
lease->extradata_size = lease->extradata_len = 0;
|
||||||
lease->hwaddr_len = 0; /* surrogate for no of vendor classes */
|
lease->vendorclass_count = 0;
|
||||||
|
|
||||||
if ((class_opt = opt6_find(state->packet_options, state->end, OPTION6_VENDOR_CLASS, 4)))
|
if ((class_opt = opt6_find(state->packet_options, state->end, OPTION6_VENDOR_CLASS, 4)))
|
||||||
{
|
{
|
||||||
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));
|
||||||
lease->hwaddr_len++;
|
lease->vendorclass_count++;
|
||||||
/* send enterprise number first */
|
/* send enterprise number first */
|
||||||
sprintf(daemon->dhcp_buff2, "%u", opt6_uint(class_opt, 0, 4));
|
sprintf(daemon->dhcp_buff2, "%u", opt6_uint(class_opt, 0, 4));
|
||||||
lease_add_extradata(lease, (unsigned char *)daemon->dhcp_buff2, strlen(daemon->dhcp_buff2), 0);
|
lease_add_extradata(lease, (unsigned char *)daemon->dhcp_buff2, strlen(daemon->dhcp_buff2), 0);
|
||||||
@@ -1622,7 +1622,7 @@ static void update_leases(struct state *state, struct dhcp_context *context, str
|
|||||||
if (opt6_len(class_opt) >= 6)
|
if (opt6_len(class_opt) >= 6)
|
||||||
for (enc_opt = opt6_ptr(class_opt, 4); enc_opt; enc_opt = opt6_next(enc_opt, enc_end))
|
for (enc_opt = opt6_ptr(class_opt, 4); enc_opt; enc_opt = opt6_next(enc_opt, enc_end))
|
||||||
{
|
{
|
||||||
lease->hwaddr_len++;
|
lease->vendorclass_count++;
|
||||||
lease_add_extradata(lease, opt6_ptr(enc_opt, 0), opt6_len(enc_opt), 0);
|
lease_add_extradata(lease, opt6_ptr(enc_opt, 0), opt6_len(enc_opt), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user