util.ip: Fix netmask for link-local address range
This may have mistakenly caused link-local addresses to be considered
global. May have caused mod_s2s and prosodyctl check dns to behave
incorrectly on networks using link-local IPv4 addresses. By my
guesstimate, these are extremely rare. Probably minimal impact beyond
a bit longer to establish s2s and some possible confusion from
prosodyctl check dns results.
Ref RFC 3927
--- a/util/ip.lua Thu May 27 12:35:55 2021 +0200
+++ b/util/ip.lua Sat Jul 03 03:27:57 2021 +0200
@@ -100,7 +100,7 @@
local function v4scope(ip)
if match(ip, loopback4, 8) then
return 0x2;
- elseif match(ip, linklocal4) then
+ elseif match(ip, linklocal4, 16) then
return 0x2;
else -- Global unicast
return 0xE;