]> git.ipfire.org Git - people/ms/dnsmasq.git/commitdiff
Putative fix to crash in IPv4 DHCP, introduced whilst
authorSimon Kelley <simon@thekelleys.org.uk>
Wed, 15 Feb 2012 21:58:33 +0000 (21:58 +0000)
committerSimon Kelley <simon@thekelleys.org.uk>
Wed, 15 Feb 2012 21:58:33 +0000 (21:58 +0000)
generalising the DHCP option filter code:
don't match options against context tag  when
context->netid.net == NULL, since there's no tag then.

src/dhcp-common.c
src/lease.c
src/rfc2131.c

index 2e404479bc81c62a912086242de55b9c079cf0f7..6de8e61ab6d787d89a7c3184bf8a8c6194e478e4 100644 (file)
@@ -102,7 +102,7 @@ struct dhcp_netid *option_filter(struct dhcp_netid *tags, struct dhcp_netid *con
     }
 
   /* now flag options which are valid, including the context tags,
-     otherwise valid options are inhibited if we found a higher priotity one above */
+     otherwise valid options are inhibited if we found a higher priority one above */
   if (context_tags)
     {
       struct dhcp_netid *last_tag;
index b2236c002dfef7b24a41ab9851c25fe6127125fc..57fde0fa960aa7c5a239e5efedec3365b302c3ac 100644 (file)
@@ -504,10 +504,9 @@ u64 lease_find_max_addr6(struct dhcp_context *context)
   if (!(context->flags & (CONTEXT_STATIC | CONTEXT_PROXY)))
     for (lease = leases; lease; lease = lease->next)
       {
-#ifdef HAVE_DHCP6
        if (!(lease->flags & (LEASE_TA | LEASE_NA)))
          continue;
-#endif
+
        if (is_same_net6((struct in6_addr *)lease->hwaddr, &context->start6, 64) &&
            addr6part((struct in6_addr *)lease->hwaddr) > addr6part(&context->start6) &&
            addr6part((struct in6_addr *)lease->hwaddr) <= addr6part(&context->end6) &&
index 247d698bb0f327fdf1e822d6c802bbe847b5f4c3..0dc06ab2541ad969886638ba88a4a167c7bace23 100644 (file)
@@ -2095,7 +2095,8 @@ static void do_options(struct dhcp_context *context,
   struct dhcp_netid_list *id_list;
 
   /* filter options based on tags, those we want get DHOPT_TAGOK bit set */
-  tagif = option_filter(netid, &context->netid, config_opts);
+  context->netid.next = NULL;
+  tagif = option_filter(netid, context->netid.net ? &context->netid : NULL, config_opts);
        
   /* logging */
   if (option_bool(OPT_LOG_OPTS) && req_options)