From 2b289f34f929a69424a22bb0de3b668a58ba80cd 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 40ffc88bad91782bf8564994826b528609004751 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 9d5c3cb856ad15611be84d5324caa8413175f4fe 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 b20f96afc1ea09e70fb7ffa04757940096e989bc 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 d1fbb9197f3546153fc52428115a725eb1399a4c 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 6137789b45618e04d261ef8fba40ad69ebda874f 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 7b89ab9b86d3588717c0833a7b9b89c7513a459e 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 300a9a56c55f29e8ad422973f4674a858c5f30bc 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