|
|
93ac1e |
From 24b5a5d50bc793f7e218ef6018ad210eab28c686 Mon Sep 17 00:00:00 2001
|
|
|
93ac1e |
From: Simon Kelley <simon@thekelleys.org.uk>
|
|
|
93ac1e |
Date: Fri, 11 Oct 2013 15:19:28 +0100
|
|
|
93ac1e |
Subject: [PATCH 1/1] dhcp-host selection fix for v4/v6
|
|
|
93ac1e |
|
|
|
93ac1e |
---
|
|
|
93ac1e |
CHANGELOG | 5 +++++
|
|
|
93ac1e |
src/dhcp-common.c | 35 +++++++++++++++++------------------
|
|
|
93ac1e |
src/rfc1035.c | 14 +++++++-------
|
|
|
93ac1e |
3 files changed, 29 insertions(+), 25 deletions(-)
|
|
|
93ac1e |
|
|
|
93ac1e |
diff --git a/src/dhcp-common.c b/src/dhcp-common.c
|
|
|
93ac1e |
index 304c47e..5b0756d 100644
|
|
|
93ac1e |
--- a/src/dhcp-common.c
|
|
|
93ac1e |
+++ b/src/dhcp-common.c
|
|
|
93ac1e |
@@ -272,27 +272,26 @@ static int is_config_in_context(struct dhcp_context *context, struct dhcp_config
|
|
|
93ac1e |
if (!context) /* called via find_config() from lease_update_from_configs() */
|
|
|
93ac1e |
return 1;
|
|
|
93ac1e |
|
|
|
93ac1e |
- if (!(context->flags & CONTEXT_V6))
|
|
|
93ac1e |
- {
|
|
|
93ac1e |
- if (!(config->flags & CONFIG_ADDR))
|
|
|
93ac1e |
- return 1;
|
|
|
93ac1e |
+ if (!(config->flags & (CONFIG_ADDR | CONFIG_ADDR6)))
|
|
|
93ac1e |
+ return 1;
|
|
|
93ac1e |
+
|
|
|
93ac1e |
+#ifdef HAVE_DHCP6
|
|
|
93ac1e |
+ if ((context->flags & CONTEXT_V6) && (config->flags & CONFIG_WILDCARD))
|
|
|
93ac1e |
+ return 1;
|
|
|
93ac1e |
+#endif
|
|
|
93ac1e |
|
|
|
93ac1e |
- for (; context; context = context->current)
|
|
|
93ac1e |
- if (is_same_net(config->addr, context->start, context->netmask))
|
|
|
93ac1e |
- return 1;
|
|
|
93ac1e |
- }
|
|
|
93ac1e |
+ for (; context; context = context->current)
|
|
|
93ac1e |
#ifdef HAVE_DHCP6
|
|
|
93ac1e |
- else
|
|
|
93ac1e |
- {
|
|
|
93ac1e |
- if (!(config->flags & CONFIG_ADDR6) || (config->flags & CONFIG_WILDCARD))
|
|
|
93ac1e |
- return 1;
|
|
|
93ac1e |
-
|
|
|
93ac1e |
- for (; context; context = context->current)
|
|
|
93ac1e |
- if (is_same_net6(&config->addr6, &context->start6, context->prefix))
|
|
|
93ac1e |
- return 1;
|
|
|
93ac1e |
- }
|
|
|
93ac1e |
+ if (context->flags & CONTEXT_V6)
|
|
|
93ac1e |
+ {
|
|
|
93ac1e |
+ if ((config->flags & CONFIG_ADDR6) && is_same_net6(&config->addr6, &context->start6, context->prefix))
|
|
|
93ac1e |
+ return 1;
|
|
|
93ac1e |
+ }
|
|
|
93ac1e |
+ else
|
|
|
93ac1e |
#endif
|
|
|
93ac1e |
-
|
|
|
93ac1e |
+ if ((config->flags & CONFIG_ADDR) && is_same_net(config->addr, context->start, context->netmask))
|
|
|
93ac1e |
+ return 1;
|
|
|
93ac1e |
+
|
|
|
93ac1e |
return 0;
|
|
|
93ac1e |
}
|
|
|
93ac1e |
|