src/httpserver.cpp
static bool InitHTTPAllowList()
{
    rpc_allow_subnets.clear();
    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
    for (const std::string& strAllow : gArgs.GetArgs("-rpcallowip")) {
        CSubNet subnet;
        LookupSubNet(strAllow, 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),
                "", CClientUIInterface::MSG_ERROR);
            return false;
        }
        rpc_allow_subnets.push_back(subnet);
    }
    std::string strAllowed;
    for (const CSubNet& subnet : rpc_allow_subnets)
        strAllowed += subnet.ToString() + " ";
    LogPrint(BCLog::HTTP, "Allowing HTTP connections from: %s\n", strAllowed);
    return true;
}
/** Initialize ACL list for HTTP server */
Initialize ACL list for HTTP server
Initialize ACL list for HTTP server
static bool InitHTTPAllowList()
{
    rpc_allow_subnets.clear();
    CNetAddr localv4;
    CNetAddr localv6;
    LookupHost("127.0.0.1", localv4, false);
    LookupHost("::1", localv6, false);
    rpc_allow_subnets.push_back(CSubNet(localv4, 8));      
    rpc_allow_subnets.push_back(CSubNet(localv6));         
    for (const std::string& strAllow : gArgs.GetArgs("-rpcallowip")) {
        CSubNet subnet;
        LookupSubNet(strAllow, 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),
                "", CClientUIInterface::MSG_ERROR);
            return false;
        }
        rpc_allow_subnets.push_back(subnet);
    }
    std::string strAllowed;
    for (const CSubNet& subnet : rpc_allow_subnets)
        strAllowed += subnet.ToString() + " ";
    LogPrint(BCLog::HTTP, "Allowing HTTP connections from: %s\n", strAllowed);
    return true;
}
static bool InitHTTPAllowList ( ) { rpc_allow_subnets . clear ( ) ; CNetAddr localv4 ; CNetAddr localv6 ; LookupHost ( " " , localv4 , false ) ; LookupHost ( " " , localv6 , false ) ; rpc_allow_subnets . push_back ( CSubNet ( localv4 , 8 ) ) ; rpc_allow_subnets . push_back ( CSubNet ( localv6 ) ) ; for ( const std :: string & strAllow : gArgs . GetArgs ( " " ) ) { CSubNet subnet ; LookupSubNet ( strAllow , subnet ) ; if ( ! subnet . IsValid ( ) ) { uiInterface . ThreadSafeMessageBox ( strprintf ( " " , strAllow ) , " " , CClientUIInterface :: MSG_ERROR ) ; return false ; } rpc_allow_subnets . push_back ( subnet ) ; } std :: string strAllowed ; for ( const CSubNet & subnet : rpc_allow_subnets ) strAllowed += subnet . ToString ( ) + " " ; LogPrint ( BCLog :: HTTP , " \n " , strAllowed ) ; return true ; }
Initialize ACL list for HTTP server
Initialize ACL list for HTTP server
// always allow IPv4 local subnet // always allow IPv6 localhost