Browse Source

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.
pull/279/head
fekt 1 year ago
parent
commit
883e598994
  1. 6
      src/stratum.cpp

6
src/stratum.cpp

@ -123,10 +123,8 @@ namespace { // better to use anonymous namespace for helper routines
if (mapMultiArgs.count("-stratumallowip")) {
const std::vector<std::string>& 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),

Loading…
Cancel
Save