From d63a7ba06f10d02bf9deee3923af77e4a138b38f Mon Sep 17 00:00:00 2001 From: chronolaw Date: Fri, 19 Jul 2024 14:52:48 +0800 Subject: [PATCH] parse_resolv_conf --- kong/dns/utils.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kong/dns/utils.lua b/kong/dns/utils.lua index a197761af541..7560f3d69cc9 100644 --- a/kong/dns/utils.lua +++ b/kong/dns/utils.lua @@ -150,6 +150,7 @@ local function parse_resolv_conf(path, enable_ipv6) -- nameservers if resolv.nameserver then + local n = 0 local nameservers = {} for _, address in ipairs(resolv.nameserver) do @@ -157,7 +158,8 @@ local function parse_resolv_conf(path, enable_ipv6) if t == "ipv4" or (t == "ipv6" and not ip:find([[%]], nil, true) and enable_ipv6) then - table_insert(nameservers, port and { ip, port } or ip) + n = n + 1 + nameservers[n] = port and { ip, port } or ip end end