diff options
author | Cory Fields <cory-nospam-@coryfields.com> | 2016-05-31 15:50:24 -0400 |
---|---|---|
committer | Cory Fields <cory-nospam-@coryfields.com> | 2016-07-31 14:01:43 -0400 |
commit | b6c3ff3daed432e71d1c5bfe2357c4bb9fdc862a (patch) | |
tree | 102e1236181b8fd21235e31154c160cc9a393757 /src/httpserver.cpp | |
parent | f96c7c4d91f3c09d26658bc9c15aa561689fa2d4 (diff) |
net: Split resolving out of CSubNet
Diffstat (limited to 'src/httpserver.cpp')
-rw-r--r-- | src/httpserver.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/httpserver.cpp b/src/httpserver.cpp index 57aa134b38..2c5bc2c792 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -197,12 +197,17 @@ static bool ClientAllowed(const CNetAddr& netaddr) static bool InitHTTPAllowList() { rpc_allow_subnets.clear(); - rpc_allow_subnets.push_back(CSubNet("127.0.0.0/8")); // always allow IPv4 local subnet - rpc_allow_subnets.push_back(CSubNet("::1")); // always allow IPv6 localhost + CNetAddr localv4; + CNetAddr localv6; + LookupHost("127.0.0.1", localv4, false); + LookupHost("::1", localv6, false); + rpc_allow_subnets.push_back(CSubNet(localv4, 8)); // always allow IPv4 local subnet + rpc_allow_subnets.push_back(CSubNet(localv6)); // always allow IPv6 localhost if (mapMultiArgs.count("-rpcallowip")) { const std::vector<std::string>& vAllow = mapMultiArgs["-rpcallowip"]; for (std::string strAllow : vAllow) { - CSubNet subnet(strAllow); + CSubNet subnet; + LookupSubNet(strAllow.c_str(), subnet); if (!subnet.IsValid()) { uiInterface.ThreadSafeMessageBox( strprintf("Invalid -rpcallowip 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), |