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.
This commit is contained in:
@@ -123,10 +123,8 @@ namespace { // better to use anonymous namespace for helper routines
|
|||||||
if (mapMultiArgs.count("-stratumallowip")) {
|
if (mapMultiArgs.count("-stratumallowip")) {
|
||||||
const std::vector<std::string>& vAllow = mapMultiArgs["-stratumallowip"];
|
const std::vector<std::string>& vAllow = mapMultiArgs["-stratumallowip"];
|
||||||
for(const std::string& strAllow : vAllow) {
|
for(const std::string& strAllow : vAllow) {
|
||||||
CNetAddr netaddr;
|
CSubNet subnet;
|
||||||
// todo: v6
|
LookupSubNet(strAllow.c_str(), subnet);
|
||||||
LookupHost(strAllow.c_str(), netaddr, false);
|
|
||||||
CSubNet subnet(netaddr);
|
|
||||||
if (!subnet.IsValid()) {
|
if (!subnet.IsValid()) {
|
||||||
uiInterface.ThreadSafeMessageBox(
|
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),
|
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),
|
||||||
|
|||||||
Reference in New Issue
Block a user