The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6569
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) ===
From d33167ab234270c39861ec373b4e5b385944184c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Fri, 6 Dec 2019 10:06:16 -0500 Subject: [PATCH 1/4] tests: Don't use fixed timestamp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- test/suites/clustering.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/suites/clustering.sh b/test/suites/clustering.sh index 74c18ab2ce..3a4eca9e82 100644 --- a/test/suites/clustering.sh +++ b/test/suites/clustering.sh @@ -1343,7 +1343,7 @@ test_clustering_dns() { echo "127.0.1.2${ipRand}" > "${lxdDir}"/networks/lxdtest1/forkdns.servers/servers.conf # Create fake DHCP lease file on forkdns2 network - echo "1560188871 00:16:3e:98:05:40 10.140.78.145 test1 ff:2b:a8:0a:df:00:02:00:00:ab:11:36:ea:11:e5:37:e0:85:45" > "${lxdDir}"/networks/lxdtest2/dnsmasq.leases + echo "$(date +%s) 00:16:3e:98:05:40 10.140.78.145 test1 ff:2b:a8:0a:df:00:02:00:00:ab:11:36:ea:11:e5:37:e0:85:45" > "${lxdDir}"/networks/lxdtest2/dnsmasq.leases # Test querying forkdns1 for A record that is on forkdns2 network if ! dig @127.0.1.1"${ipRand}" -p1053 test1.lxd | grep "10.140.78.145" ; then From e8ae84e73acd76a8adb702db5d29d249151f5598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Fri, 6 Dec 2019 12:20:05 -0500 Subject: [PATCH 2/4] lxd/forkdns: Fix help message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- lxd/main_forkdns.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lxd/main_forkdns.go b/lxd/main_forkdns.go index e5dfea7252..5ed5cfffab 100644 --- a/lxd/main_forkdns.go +++ b/lxd/main_forkdns.go @@ -412,7 +412,7 @@ func (h *dnsHandler) getLeaseHostByDNSName(dnsName string) (string, error) { func (c *cmdForkDNS) Command() *cobra.Command { // Main subcommand cmd := &cobra.Command{} - cmd.Use = "forkdns <pid path> <listen address> <domain> <network name>" + cmd.Use = "forkdns <log path> <pid path> <listen address> <domain> <network name>" cmd.Short = "Internal DNS proxy for clustering" cmd.Long = `Description: Spawns a specialised DNS server designed for relaying A and PTR queries that cannot be answered by From 02957d8257dd7abb4c3ce3a8d916c2cfe756aa35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Fri, 6 Dec 2019 12:20:16 -0500 Subject: [PATCH 3/4] lxd/forkdns: Fix logging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- lxd/main_forkdns.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lxd/main_forkdns.go b/lxd/main_forkdns.go index 5ed5cfffab..541122060f 100644 --- a/lxd/main_forkdns.go +++ b/lxd/main_forkdns.go @@ -443,7 +443,7 @@ func (c *cmdForkDNS) Run(cmd *cobra.Command, args []string) error { return fmt.Errorf("Missing required arguments") } - log, err := logging.GetLogger("lxd-forkdns", "", false, false, nil) + log, err := logging.GetLogger("lxd-forkdns", "", c.global.flagLogVerbose, c.global.flagLogDebug, nil) if err != nil { return err } @@ -462,10 +462,6 @@ func (c *cmdForkDNS) Run(cmd *cobra.Command, args []string) error { return fmt.Errorf("Unable to setup fsnotify watch on %s: %s", path, err) } - os.Stdin.Close() - os.Stderr.Close() - os.Stdout.Close() - // Run the server list monitor concurrently waiting for file changes. go serversFileMonitor(watcher, networkName) From 9ae230711ca6b7bde45eb2ff1748147d3260679e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Fri, 6 Dec 2019 12:20:25 -0500 Subject: [PATCH 4/4] lxd/forkdns: Use clean request messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- lxd/main_forkdns.go | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lxd/main_forkdns.go b/lxd/main_forkdns.go index 541122060f..f2ab1d3060 100644 --- a/lxd/main_forkdns.go +++ b/lxd/main_forkdns.go @@ -261,9 +261,6 @@ func (h *dnsHandler) handlePTR(r *dns.Msg) (dns.Msg, error) { // If we get here, then the recursion desired flag was set, meaning we cannot answer the // query locally and need to relay it to the other forkdns instances. - // This tells the remote node we only want to query their local data (to stop loops). - r.RecursionDesired = false - // Get current list of servers safely. dnsServersFileLock.Lock() servers := dnsServersList @@ -271,7 +268,12 @@ func (h *dnsHandler) handlePTR(r *dns.Msg) (dns.Msg, error) { // Query all the servers. for _, server := range servers { - resp, err := dns.Exchange(r, fmt.Sprintf("%s:1053", server)) + req := dns.Msg{} + req.Question = r.Question + req.RecursionDesired = false + req.Id = r.Id + + resp, err := dns.Exchange(&req, fmt.Sprintf("%s:1053", server)) if err != nil || len(resp.Answer) == 0 { // Error or empty response, try the next one continue @@ -358,9 +360,6 @@ func (h *dnsHandler) handleA(r *dns.Msg) (dns.Msg, error) { // If we get here, then the recursion desired flag was set, meaning we cannot answer the // query locally and need to relay it to the other forkdns instances. - // This tells the remote node we only want to query their local data (to stop loops). - r.RecursionDesired = false - // Get current list of servers safely. dnsServersFileLock.Lock() servers := dnsServersList @@ -368,7 +367,12 @@ func (h *dnsHandler) handleA(r *dns.Msg) (dns.Msg, error) { // Query all the servers. for _, server := range servers { - resp, err := dns.Exchange(r, fmt.Sprintf("%s:1053", server)) + req := dns.Msg{} + req.Question = r.Question + req.RecursionDesired = false + req.Id = r.Id + + resp, err := dns.Exchange(&req, fmt.Sprintf("%s:1053", server)) if err != nil || len(resp.Answer) == 0 { // Error or empty response, try the next one continue
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel