From 9a628081d5770934ff43052f55addffe901c4f45 Mon Sep 17 00:00:00 2001
From: Linda Lapinlampi <linda@lindalap.fi>
Date: Wed, 1 Jun 2022 20:52:00 +0000
Subject: [PATCH v2 1/2] ip2c: Reduce the IPv4 local loopback network from /8
 to /16
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Drafts have been submitted to IETF standards track reduce the size of IPv4
local loopback network ("localnet") size from /8 to /16, freeing up over
16 million IPv4-addresses as globally routable Unicast addresses on the
Internet (or other uses). This is part of a so-called "IPv4 Unicast
Extensions Project", from Seth Schoen, John Gilmore, Dave Täht, et al.

Doomseeker's IP2C code treated 127.0.0.0/8 specially: Servers from those
addresses would get assigned a special "Localhost" flag, instead of
country data returned from IP2C lookups. Now we only return "Localhost"
flags servers for in the 127.0.0.0/16 network.

Fixes: #4010
See: https://datatracker.ietf.org/doc/draft-schoen-intarea-unicast-127/
---
 src/core/ip2c/ip2c.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/core/ip2c/ip2c.h b/src/core/ip2c/ip2c.h
index e5403867..11927578 100644
--- a/src/core/ip2c/ip2c.h
+++ b/src/core/ip2c/ip2c.h
@@ -177,7 +177,7 @@ private:
 	inline bool isLocalhostAddress(unsigned ipv4Address)
 	{
 		const static unsigned LOCALHOST_BEGIN = QHostAddress("127.0.0.0").toIPv4Address();
-		const static unsigned LOCALHOST_END = QHostAddress("127.255.255.255").toIPv4Address();
+		const static unsigned LOCALHOST_END = QHostAddress("127.0.255.255").toIPv4Address();
 
 		return ipv4Address >= LOCALHOST_BEGIN && ipv4Address <= LOCALHOST_END;
 	}
-- 
2.36.1

