Fix problem in DHCPv6 vendorclass/userclass matching code.

This commit is contained in:
Tanguy Bouzeloc
2013-10-03 11:06:31 +01:00
committed by Simon Kelley
parent 1d1c795601
commit ef1d7425e3
2 changed files with 11 additions and 3 deletions

View File

@@ -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

View File

@@ -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_
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;