[lxc-devel] [lxd/master] lxd/forkdns: Properly rewrite answer
stgraber on Github
lxc-bot at linuxcontainers.org
Sun Sep 9 22:37:51 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180909/69313e47/attachment.bin>
-------------- next part --------------
From 22061ea99b7726fb5004c1b9e07ede58073c6ca6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sun, 9 Sep 2018 15:37:29 -0700
Subject: [PATCH] lxd/forkdns: Properly rewrite answer
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/main_forkdns.go | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/lxd/main_forkdns.go b/lxd/main_forkdns.go
index 0f52164238..fbc3b833a1 100644
--- a/lxd/main_forkdns.go
+++ b/lxd/main_forkdns.go
@@ -47,7 +47,16 @@ func (h *dnsHandler) ServeDNS(w dns.ResponseWriter, r *dns.Msg) {
}
// Send back the answer
- msg.Answer = resp.Answer
+ answers := []dns.RR{}
+ for _, answer := range resp.Answer {
+ rr, err := dns.NewRR(strings.Replace(answer.String(), ".__internal.", fmt.Sprintf(".%s.", h.domain), -1))
+ if err != nil {
+ continue
+ }
+
+ answers = append(answers, rr)
+ }
+ msg.Answer = answers
w.WriteMsg(&msg)
return
}
More information about the lxc-devel
mailing list