From 6bd109aa2f4ed9f17d8bbfb8b19b63fa33a2a351 Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Sat, 27 Jul 2013 15:11:44 +0100 Subject: [PATCH] Better job with domain for DHCPv6 information-request. --- src/domain.c | 2 +- src/rfc3315.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/domain.c b/src/domain.c index 821f769..3df4ab8 100644 --- a/src/domain.c +++ b/src/domain.c @@ -224,7 +224,7 @@ char *get_domain6(struct in6_addr *addr) { struct cond_domain *c; - if ((c = search_domain6(addr, daemon->cond_domain))) + if (addr && (c = search_domain6(addr, daemon->cond_domain))) return c->domain; return daemon->domain_suffix; diff --git a/src/rfc3315.c b/src/rfc3315.c index 56e04a1..22d1983 100644 --- a/src/rfc3315.c +++ b/src/rfc3315.c @@ -1015,6 +1015,15 @@ static int dhcp6_no_relay(int msg_type, struct in6_addr *link_address, struct dh context->netid.next = NULL; state.context_tags = &context->netid; } + + /* Similarly, we can't determine domain from address, but if the FQDN is + given in --dhcp-host, we can use that, and failing that we can use the + unqualified configured domain, if any. */ + if (state.hostname_auth) + state.send_domain = state.domain; + else + state.send_domain = get_domain6(NULL); + log6_packet(&state, "DHCPINFORMATION-REQUEST", NULL, ignore ? _("ignored") : state.hostname); if (ignore) return 0;