From 883e598994d84b5649bbb6ba70a8b6622a426cde Mon Sep 17 00:00:00 2001 From: fekt Date: Sat, 18 Feb 2023 17:30:33 +0000 Subject: [PATCH] Fix for #270 to allow subnets This seems to work as expected and allows CIDR, subnet, and single IP while rejecting IPs out of range. --- src/stratum.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/stratum.cpp b/src/stratum.cpp index c4e2fc161..5d20e8a7c 100644 --- a/src/stratum.cpp +++ b/src/stratum.cpp @@ -123,10 +123,8 @@ namespace { // better to use anonymous namespace for helper routines if (mapMultiArgs.count("-stratumallowip")) { const std::vector& vAllow = mapMultiArgs["-stratumallowip"]; for(const std::string& strAllow : vAllow) { - CNetAddr netaddr; - // todo: v6 - LookupHost(strAllow.c_str(), netaddr, false); - CSubNet subnet(netaddr); + CSubNet subnet; + LookupSubNet(strAllow.c_str(), subnet); if (!subnet.IsValid()) { uiInterface.ThreadSafeMessageBox( strprintf("Invalid -stratumallowip subnet specification: %s. Valid are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24).", strAllow),