From 6dcf53f7b284f265ce3f2215e33c6f0c28be5ce9 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 8 Dec 2018 17:09:55 +0100 Subject: various: Don't rely on _G.unpack existing --- net/resolvers/basic.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'net/resolvers/basic.lua') diff --git a/net/resolvers/basic.lua b/net/resolvers/basic.lua index 9a3c9952..56f9c77d 100644 --- a/net/resolvers/basic.lua +++ b/net/resolvers/basic.lua @@ -1,5 +1,6 @@ local adns = require "net.adns"; local inet_pton = require "util.net".pton; +local unpack = table.unpack or unpack; -- luacheck: ignore 113 local methods = {}; local resolver_mt = { __index = methods }; -- cgit v1.2.3 From 02fcdb63ef83c533cc4aa3559401e7c24e125f2d Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 7 Dec 2019 17:05:00 +0100 Subject: net.connect: Add some TODOs and FIXMEs And mention issue numbers: #1246, #1428 and #1429 --- net/resolvers/basic.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'net/resolvers/basic.lua') diff --git a/net/resolvers/basic.lua b/net/resolvers/basic.lua index c1931dab..ef69e6dc 100644 --- a/net/resolvers/basic.lua +++ b/net/resolvers/basic.lua @@ -7,6 +7,10 @@ local unpack = table.unpack or unpack; -- luacheck: ignore 113 local methods = {}; local resolver_mt = { __index = methods }; +-- TODO Respect use_ipv4, use_ipv6 +-- FIXME #1428 Reuse DNS resolver object (from service resolver) +-- FIXME #1429 Close DNS resolver object when done + -- Find the next target to connect to, and -- pass it to cb() function methods:next(cb) -- cgit v1.2.3 From 9c4ff0b7127ca04f826689fd400bd4dc323922d8 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 7 Dec 2019 17:39:29 +0100 Subject: net.connect: Mention RFC 6724 regression Default Address Selection algorithm is not applied, resulting in a strong bias towards IPv4. --- net/resolvers/basic.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'net/resolvers/basic.lua') diff --git a/net/resolvers/basic.lua b/net/resolvers/basic.lua index ef69e6dc..41ebda80 100644 --- a/net/resolvers/basic.lua +++ b/net/resolvers/basic.lua @@ -8,6 +8,7 @@ local methods = {}; local resolver_mt = { __index = methods }; -- TODO Respect use_ipv4, use_ipv6 +-- FIXME RFC 6724 -- FIXME #1428 Reuse DNS resolver object (from service resolver) -- FIXME #1429 Close DNS resolver object when done -- cgit v1.2.3 From 0e57190857be0c6d97b17321d62a7b18242b1288 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sat, 25 Jan 2020 14:03:30 +0000 Subject: net.resolvers.basic: Obey use_ipv4/use_ipv6 --- net/resolvers/basic.lua | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'net/resolvers/basic.lua') diff --git a/net/resolvers/basic.lua b/net/resolvers/basic.lua index 41ebda80..7d326c44 100644 --- a/net/resolvers/basic.lua +++ b/net/resolvers/basic.lua @@ -42,23 +42,28 @@ function methods:next(cb) -- Resolve DNS to target list local dns_resolver = adns.resolver(); - dns_resolver:lookup(function (answer) - if answer then - for _, record in ipairs(answer) do - table.insert(targets, { self.conn_type.."4", record.a, self.port, self.extra }); + + if self.connector_options.use_ipv4 ~= false then + dns_resolver:lookup(function (answer) + if answer then + for _, record in ipairs(answer) do + table.insert(targets, { self.conn_type.."4", record.a, self.port, self.extra }); + end end - end - ready(); - end, self.hostname, "A", "IN"); + ready(); + end, self.hostname, "A", "IN"); + end - dns_resolver:lookup(function (answer) - if answer then - for _, record in ipairs(answer) do - table.insert(targets, { self.conn_type.."6", record.aaaa, self.port, self.extra }); + if self.connector_options.use_ipv6 ~= false then + dns_resolver:lookup(function (answer) + if answer then + for _, record in ipairs(answer) do + table.insert(targets, { self.conn_type.."6", record.aaaa, self.port, self.extra }); + end end - end - ready(); - end, self.hostname, "AAAA", "IN"); + ready(); + end, self.hostname, "AAAA", "IN"); + end end local function new(hostname, port, conn_type, extra) -- cgit v1.2.3 From ecb2a069af5f1f96583b7b1c0ec88e2bf30d3980 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sat, 25 Jan 2020 14:38:17 +0000 Subject: net.resolvers.basic: Obey extra.use_ipv4/use_ipv6 --- net/resolvers/basic.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'net/resolvers/basic.lua') diff --git a/net/resolvers/basic.lua b/net/resolvers/basic.lua index 7d326c44..438448b2 100644 --- a/net/resolvers/basic.lua +++ b/net/resolvers/basic.lua @@ -43,7 +43,7 @@ function methods:next(cb) -- Resolve DNS to target list local dns_resolver = adns.resolver(); - if self.connector_options.use_ipv4 ~= false then + if not self.extra or self.extra.use_ipv4 ~= false then dns_resolver:lookup(function (answer) if answer then for _, record in ipairs(answer) do @@ -54,7 +54,7 @@ function methods:next(cb) end, self.hostname, "A", "IN"); end - if self.connector_options.use_ipv6 ~= false then + if not self.extra or self.extra.use_ipv6 ~= false then dns_resolver:lookup(function (answer) if answer then for _, record in ipairs(answer) do -- cgit v1.2.3 From 6d67164438abe237f394d88fbd4d38204aec78e8 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 26 Jan 2020 14:35:35 +0100 Subject: net.resolvers.basic: Fix continuing if IPv6 or Legacy IP is disabled The code expects ready() to be called twice, but with IPv4 or v6 disabled it would only be called once. --- net/resolvers/basic.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'net/resolvers/basic.lua') diff --git a/net/resolvers/basic.lua b/net/resolvers/basic.lua index 438448b2..75c23a58 100644 --- a/net/resolvers/basic.lua +++ b/net/resolvers/basic.lua @@ -52,6 +52,8 @@ function methods:next(cb) end ready(); end, self.hostname, "A", "IN"); + else + ready(); end if not self.extra or self.extra.use_ipv6 ~= false then @@ -63,6 +65,8 @@ function methods:next(cb) end ready(); end, self.hostname, "AAAA", "IN"); + else + ready(); end end -- cgit v1.2.3 From 84673d1d4ede9f69e6210438a198456fe010366c Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 22 Jun 2020 01:42:18 +0200 Subject: net.connect: Remove TODO about use_ipv4/6 done in 3bfb20be844c --- net/resolvers/basic.lua | 1 - 1 file changed, 1 deletion(-) (limited to 'net/resolvers/basic.lua') diff --git a/net/resolvers/basic.lua b/net/resolvers/basic.lua index 75c23a58..84529bc5 100644 --- a/net/resolvers/basic.lua +++ b/net/resolvers/basic.lua @@ -7,7 +7,6 @@ local unpack = table.unpack or unpack; -- luacheck: ignore 113 local methods = {}; local resolver_mt = { __index = methods }; --- TODO Respect use_ipv4, use_ipv6 -- FIXME RFC 6724 -- FIXME #1428 Reuse DNS resolver object (from service resolver) -- FIXME #1429 Close DNS resolver object when done -- cgit v1.2.3 From 1773caa0a30634d92328d4a893c5a2837dbac966 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 25 Jun 2020 19:24:58 +0200 Subject: net.resolvers: Remove FIXMEs obsoleted by switch to libunbound --- net/resolvers/basic.lua | 2 -- 1 file changed, 2 deletions(-) (limited to 'net/resolvers/basic.lua') diff --git a/net/resolvers/basic.lua b/net/resolvers/basic.lua index 84529bc5..6458c638 100644 --- a/net/resolvers/basic.lua +++ b/net/resolvers/basic.lua @@ -8,8 +8,6 @@ local methods = {}; local resolver_mt = { __index = methods }; -- FIXME RFC 6724 --- FIXME #1428 Reuse DNS resolver object (from service resolver) --- FIXME #1429 Close DNS resolver object when done -- Find the next target to connect to, and -- pass it to cb() -- cgit v1.2.3