Commit ef1d7425 authored by Tanguy Bouzeloc's avatar Tanguy Bouzeloc Committed by Simon Kelley

Fix problem in DHCPv6 vendorclass/userclass matching code.

parent 1d1c7956
...@@ -127,6 +127,9 @@ version 2.67 ...@@ -127,6 +127,9 @@ version 2.67
Update Polish translation. Thanks to Jan Psota. Update Polish translation. Thanks to Jan Psota.
Fix problem in DHCPv6 vendorclass/userclass matching
code. Thanks to Tanguy Bouzeloc for the patch.
version 2.66 version 2.66
Add the ability to act as an authoritative DNS Add the ability to act as an authoritative DNS
......
...@@ -66,6 +66,10 @@ static void calculate_times(struct dhcp_context *context, unsigned int *min_time ...@@ -66,6 +66,10 @@ static void calculate_times(struct dhcp_context *context, unsigned int *min_time
#define opt6_type(opt) (opt6_uint(opt, -4, 2)) #define opt6_type(opt) (opt6_uint(opt, -4, 2))
#define opt6_ptr(opt, i) ((void *)&(((unsigned char *)(opt))[4+(i)])) #define opt6_ptr(opt, i) ((void *)&(((unsigned char *)(opt))[4+(i)]))
#define opt6_user_vendor_ptr(opt, i) ((void *)&(((unsigned char *)(opt))[2+(i)]))
#define opt6_user_vendor_len(opt) ((int)(opt6_uint(opt, -4, 2)))
#define opt6_user_vendor_next(opt, end) (opt6_next(((void *) opt) - 2, end))
unsigned short dhcp6_reply(struct dhcp_context *context, int interface, char *iface_name, unsigned short dhcp6_reply(struct dhcp_context *context, int interface, char *iface_name,
struct in6_addr *fallback, size_t sz, struct in6_addr *client_addr, time_t now) struct in6_addr *fallback, size_t sz, struct in6_addr *client_addr, time_t now)
...@@ -355,9 +359,10 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_ ...@@ -355,9 +359,10 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
offset = 4; offset = 4;
} }
for (enc_opt = opt6_ptr(opt, offset); enc_opt; enc_opt = opt6_next(enc_opt, enc_end)) /* Note that format if user/vendor classes is different to DHCP options - no option types. */
for (i = 0; i <= (opt6_len(enc_opt) - vendor->len); i++) for (enc_opt = opt6_ptr(opt, offset); enc_opt; enc_opt = opt6_user_vendor_next(enc_opt, enc_end))
if (memcmp(vendor->data, opt6_ptr(enc_opt, i), vendor->len) == 0) for (i = 0; i <= (opt6_user_vendor_len(enc_opt) - vendor->len); i++)
if (memcmp(vendor->data, opt6_user_vendor_ptr(enc_opt, i), vendor->len) == 0)
{ {
vendor->netid.next = state->tags; vendor->netid.next = state->tags;
state->tags = &vendor->netid; state->tags = &vendor->netid;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment