Blame SOURCES/dnsmasq-2.81-rh1829448.patch

5bc043
From 3d113137fd64cd0723cbecab6a36a75d3ecfb0a6 Mon Sep 17 00:00:00 2001
5bc043
From: =?UTF-8?q?Harald=20Jens=C3=A5s?= <hjensas@redhat.com>
5bc043
Date: Thu, 7 May 2020 00:33:54 +0200
5bc043
Subject: [PATCH 1/1] Fix regression in s_config_in_context() method
5bc043
5bc043
Prior to commit 137286e9baecf6a3ba97722ef1b49c851b531810
5bc043
a config would not be considered in context if:
5bc043
a) it has no address family flags set
5bc043
b) it has the address family flag of current context set
5bc043
5bc043
Since above commit config is considered in context if the
5bc043
address family is the opposite of current context.
5bc043
5bc043
The result is that a config with two dhcp-host records,
5bc043
one for IPv6 and another for IPv4 no longer works, for
5bc043
example with the below config the config with the IPv6
5bc043
address would be considered in context for a DHCP(v4)
5bc043
request.
5bc043
 dhcp-host=52:54:00:bc:c3:fd,172.20.0.11,host2
5bc043
 dhcp-host=52:54:00:bc:c3:fd,[fd12:3456:789a:1::aadd],host2
5bc043
5bc043
This commit restores the previous behavior.
5bc043
---
5bc043
 src/dhcp-common.c | 10 +++++++---
5bc043
 1 file changed, 7 insertions(+), 3 deletions(-)
5bc043
5bc043
diff --git a/src/dhcp-common.c b/src/dhcp-common.c
5bc043
index eae9886..ffc78ca 100644
5bc043
--- a/src/dhcp-common.c
5bc043
+++ b/src/dhcp-common.c
5bc043
@@ -280,14 +280,18 @@ static int is_config_in_context(struct dhcp_context *context, struct dhcp_config
5bc043
 {
5bc043
   if (!context) /* called via find_config() from lease_update_from_configs() */
5bc043
     return 1; 
5bc043
-  
5bc043
+
5bc043
+  /* No address present in config == in context */
5bc043
+  if (!(config->flags & (CONFIG_ADDR | CONFIG_ADDR6)))
5bc043
+    return 1;
5bc043
+
5bc043
 #ifdef HAVE_DHCP6
5bc043
   if (context->flags & CONTEXT_V6)
5bc043
     {
5bc043
        struct addrlist *addr_list;
5bc043
 
5bc043
        if (!(config->flags & CONFIG_ADDR6))
5bc043
-	 return 1;
5bc043
+	 return 0;
5bc043
        
5bc043
         for (; context; context = context->current)
5bc043
 	  for (addr_list = config->addr6; addr_list; addr_list = addr_list->next)
5bc043
@@ -303,7 +307,7 @@ static int is_config_in_context(struct dhcp_context *context, struct dhcp_config
5bc043
 #endif
5bc043
     {
5bc043
       if (!(config->flags & CONFIG_ADDR))
5bc043
-	return 1;
5bc043
+	return 0;
5bc043
       
5bc043
       for (; context; context = context->current)
5bc043
 	if ((config->flags & CONFIG_ADDR) && is_same_net(config->addr, context->start, context->netmask))
5bc043
-- 
5bc043
2.25.4