From 9c9722935aeb5040995f0dbf56af455a1b146310 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 24 Nov 2019 04:26:44 +0100 Subject: net.resolvers.basic: Fix resolution of IPv6 literals (in brackets) (fixes #1459) --- net/resolvers/basic.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'net') diff --git a/net/resolvers/basic.lua b/net/resolvers/basic.lua index e3a94382..93182fda 100644 --- a/net/resolvers/basic.lua +++ b/net/resolvers/basic.lua @@ -59,6 +59,9 @@ local function new(hostname, port, conn_type, extra) local targets = nil; local is_ip = inet_pton(hostname); + if not is_ip and hostname:sub(1,1) == '[' then + is_ip = inet_pton(hostname:sub(2,-2)); + end if is_ip then if #is_ip == 16 then targets = { { conn_type.."6", hostname, port, extra } }; -- cgit v1.2.3