# HG changeset patch # User Matthew Wild # Date 1368909677 -3600 # Node ID 3049137d14b69e980cd687292539f7732ebdeac7 # Parent 306aabf2d57df74a4dae0cb19fe44204ec3e8a74 util.ip: Fix protocol detection of IPv6 addresses beginning with : [Backported from 0.10] diff -r 306aabf2d57d -r 3049137d14b6 util/ip.lua --- a/util/ip.lua Fri May 17 14:52:52 2013 +0100 +++ b/util/ip.lua Sat May 18 21:41:17 2013 +0100 @@ -14,8 +14,10 @@ local function new_ip(ipStr, proto) if not proto then local sep = ipStr:match("^%x+(.)"); - if sep == ":" then proto = "IPv6" - elseif sep == "." then proto = "IPv4" + if sep == ":" or (not(sep) and ipStr:sub(1,1) == ":") then + proto = "IPv6" + elseif sep == "." then + proto = "IPv4" end if not proto then return nil, "invalid address";