diff --git a/src/httpserver.cpp b/src/httpserver.cpp --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -306,7 +306,7 @@ std::vector> endpoints; // Determine what addresses to bind to - if (!gArgs.IsArgSet("-rpcallowip")) { + if (!(gArgs.IsArgSet("-rpcallowip") && gArgs.IsArgSet("-rpcbind")) { // Default to loopback if not allowing external IPs. endpoints.push_back(std::make_pair("::1", defaultPort)); endpoints.push_back(std::make_pair("127.0.0.1", defaultPort)); @@ -315,6 +315,10 @@ "-rpcallowip was not specified, refusing to allow " "everyone to connect\n"); } + if (gArgs.IsArgSet("-rpcallowip")) { + LogPrintf("WARNING: option -rpcallowip was specified without" + "-rpcbind; this doesn't usually make sense\n"); + } } else if (gArgs.IsArgSet("-rpcbind")) { // Specific bind address. for (const std::string &strRPCBind : gArgs.GetArgs("-rpcbind")) { @@ -323,10 +327,6 @@ SplitHostPort(strRPCBind, port, host); endpoints.push_back(std::make_pair(host, port)); } - } else { - // No specific bind address specified, bind to any. - endpoints.push_back(std::make_pair("::", defaultPort)); - endpoints.push_back(std::make_pair("0.0.0.0", defaultPort)); } // Bind addresses @@ -339,8 +339,11 @@ http, i->first.empty() ? nullptr : i->first.c_str(), i->second); if (bind_handle) { CNetAddr addr; - if (i->first.empty() || (LookupHost(i->first.c_str(), addr, false) && addr.IsBindAny())) { - LogPrintf("WARNING: the RPC server is not safe to expose to untrusted networks such as the public internet\n"); + if (i->first.empty() || + (LookupHost(i->first.c_str(), addr, false) && + addr.IsBindAny())) { + LogPrintf("WARNING: the RPC server is not safe to expose to " + "untrusted networks such as the public internet\n"); } boundSockets.push_back(bind_handle); } else {