util.ip: Fix netmask for link-local address range 0.11
authorKim Alvefur <zash@zash.se>
Sat, 03 Jul 2021 03:27:57 +0200
branch0.11
changeset 11653 aa119de5f6c7
parent 11590 35e880501efd
child 11654 a227bc35771e
child 11716 d117b92fd8e4
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
util/ip.lua
--- 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;