diff --git a/src/dnsmasq.h b/src/dnsmasq.h index 482af22..69ae7a7 100644 --- a/src/dnsmasq.h +++ b/src/dnsmasq.h @@ -543,6 +543,7 @@ struct dhcp_lease { int backoff; /* zero -> confirmed */ struct slaac_address *next; } *slaac_address; + int vendorclass_count; #endif struct dhcp_lease *next; }; diff --git a/src/helper.c b/src/helper.c index 94aabeb..ab691b7 100644 --- a/src/helper.c +++ b/src/helper.c @@ -655,8 +655,9 @@ void queue_script(int action, struct dhcp_lease *lease, char *hostname, time_t n unsigned char *p; unsigned int hostname_len = 0, clid_len = 0, ed_len = 0; int fd = daemon->dhcpfd; +#ifdef HAVE_DHCP6 + int is6 = !!(lease->flags & (LEASE_TA | LEASE_NA)); -#ifdef HAVE_DHCP6 if (!daemon->dhcp) fd = daemon->dhcp6fd; #endif @@ -676,7 +677,12 @@ void queue_script(int action, struct dhcp_lease *lease, char *hostname, time_t n buf->action = action; buf->flags = lease->flags; - buf->hwaddr_len = lease->hwaddr_len; +#ifdef HAVE_DHCP6 + if (is6) + buf->hwaddr_len = lease->vendorclass_count; + else +#endif + buf->hwaddr_len = lease->hwaddr_len; buf->hwaddr_type = lease->hwaddr_type; buf->clid_len = clid_len; buf->ed_len = ed_len; diff --git a/src/rfc3315.c b/src/rfc3315.c index 9d11fe1..c8ba3d0 100644 --- a/src/rfc3315.c +++ b/src/rfc3315.c @@ -1609,12 +1609,12 @@ static void update_leases(struct state *state, struct dhcp_context *context, str free(lease->extradata); lease->extradata = NULL; 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))) { void *enc_opt, *enc_end = opt6_ptr(class_opt, opt6_len(class_opt)); - lease->hwaddr_len++; + lease->vendorclass_count++; /* send enterprise number first */ 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); @@ -1622,7 +1622,7 @@ static void update_leases(struct state *state, struct dhcp_context *context, str if (opt6_len(class_opt) >= 6) 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); } }