commit 576aaf5988b5e1f394bb277c0e2a77732383397a
parent 19cbe4ad73ba557569c633a7a247e8775fc554d3
Author: Shinoa-Fores <btcinfo@sdf.org>
Date: Wed, 13 Jan 2021 17:23:48 -0500
asciilifeform_dns_thermonyukyoolar_kleansing.vpatch
Diffstat:
6 files changed, 25 insertions(+), 52 deletions(-)
diff --git a/bitcoin/src/init.cpp b/bitcoin/src/init.cpp
@@ -160,7 +160,6 @@ bool AppInit2(int argc, char* argv[])
" -datadir=<dir> \t\t " + _("Specify data directory\n") +
" -timeout=<n> \t " + _("Specify connection timeout (in milliseconds)\n") +
" -proxy=<ip:port> \t " + _("Connect through socks4 proxy\n") +
- " -dns \t " + _("Allow DNS lookups for addnode and connect\n") +
" -port=<port> \t\t " + _("Listen for connections on <port> (default: 8333 or testnet: 18333)\n") +
" -maxconnections=<n>\t " + _("Maintain at most <n> connections to peers (default: 125)\n") +
" -addnode=<ip> \t " + _("Add a node to connect to\n") +
@@ -414,10 +413,8 @@ bool AppInit2(int argc, char* argv[])
// Note: the GetBoolArg() calls for all of these must happen later.
SoftSetArg("-nolisten", true);
SoftSetArg("-noirc", true);
- SoftSetArg("-dns", false);
}
- fAllowDNS = GetBoolArg("-dns");
fNoListen = GetBoolArg("-nolisten");
// Command-line args override in-wallet settings:
@@ -435,7 +432,7 @@ bool AppInit2(int argc, char* argv[])
{
BOOST_FOREACH(string strAddr, mapMultiArgs["-addnode"])
{
- CAddress addr(strAddr, fAllowDNS);
+ CAddress addr(strAddr);
addr.nTime = 0; // so it won't relay unless successfully connected
if (addr.IsValid())
AddAddress(addr);
diff --git a/bitcoin/src/irc.cpp b/bitcoin/src/irc.cpp
@@ -269,10 +269,6 @@ void ThreadIRCSeed2(void* parg)
{
CAddress addrConnect("92.243.23.21", 6667); // irc.lfnet.org
- CAddress addrIRC("irc.lfnet.org", 6667, true);
- if (addrIRC.IsValid())
- addrConnect = addrIRC;
-
SOCKET hSocket;
if (!ConnectSocket(addrConnect, hSocket))
{
diff --git a/bitcoin/src/net.cpp b/bitcoin/src/net.cpp
@@ -29,9 +29,8 @@ bool OpenNetworkConnection(const CAddress& addrConnect);
// Global state variables
//
bool fClient = false;
-bool fAllowDNS = false;
uint64 nLocalServices = (fClient ? 0 : NODE_NETWORK);
-CAddress addrLocalHost("0.0.0.0", 0, false, nLocalServices);
+CAddress addrLocalHost("0.0.0.0", 0, nLocalServices);
static CNode* pnodeLocalHost = NULL;
uint64 nLocalHostNonce = 0;
array<int, 10> vnThreadsRunning;
@@ -193,7 +192,7 @@ bool ConnectSocket(const CAddress& addrConnect, SOCKET& hSocketRet, int nTimeout
}
// portDefault is in host order
-bool Lookup(const char *pszName, vector<CAddress>& vaddr, int nServices, int nMaxSolutions, bool fAllowLookup, int portDefault, bool fAllowPort)
+bool Lookup(const char *pszName, vector<CAddress>& vaddr, int nServices, int nMaxSolutions, int portDefault, bool fAllowPort)
{
vaddr.clear();
if (pszName[0] == 0)
@@ -231,33 +230,14 @@ bool Lookup(const char *pszName, vector<CAddress>& vaddr, int nServices, int nMa
return true;
}
- if (!fAllowLookup)
- return false;
-
- struct hostent* phostent = gethostbyname(pszHost);
- if (!phostent)
- return false;
-
- if (phostent->h_addrtype != AF_INET)
- return false;
-
- char** ppAddr = phostent->h_addr_list;
- while (*ppAddr != NULL && vaddr.size() != nMaxSolutions)
- {
- CAddress addr(((struct in_addr*)ppAddr[0])->s_addr, port, nServices);
- if (addr.IsValid())
- vaddr.push_back(addr);
- ppAddr++;
- }
-
- return (vaddr.size() > 0);
+ return false;
}
// portDefault is in host order
-bool Lookup(const char *pszName, CAddress& addr, int nServices, bool fAllowLookup, int portDefault, bool fAllowPort)
+bool Lookup(const char *pszName, CAddress& addr, int nServices, int portDefault, bool fAllowPort)
{
vector<CAddress> vaddr;
- bool fRet = Lookup(pszName, vaddr, nServices, 1, fAllowLookup, portDefault, fAllowPort);
+ bool fRet = Lookup(pszName, vaddr, nServices, 1, portDefault, fAllowPort);
if (fRet)
addr = vaddr[0];
return fRet;
@@ -1055,7 +1035,7 @@ void ThreadOpenConnections2(void* parg)
{
BOOST_FOREACH(string strAddr, mapMultiArgs["-connect"])
{
- CAddress addr(strAddr, fAllowDNS);
+ CAddress addr(strAddr);
if (addr.IsValid())
OpenNetworkConnection(addr);
for (int i = 0; i < 10 && i < nLoop; i++)
@@ -1073,7 +1053,7 @@ void ThreadOpenConnections2(void* parg)
{
BOOST_FOREACH(string strAddr, mapMultiArgs["-addnode"])
{
- CAddress addr(strAddr, fAllowDNS);
+ CAddress addr(strAddr);
if (addr.IsValid())
{
OpenNetworkConnection(addr);
@@ -1384,7 +1364,7 @@ bool BindListenPort(string& strError)
void StartNode(void* parg)
{
if (pnodeLocalHost == NULL)
- pnodeLocalHost = new CNode(INVALID_SOCKET, CAddress("127.0.0.1", 0, false, nLocalServices));
+ pnodeLocalHost = new CNode(INVALID_SOCKET, CAddress("127.0.0.1", 0, nLocalServices));
// Get local host ip
struct ifaddrs* myaddrs;
diff --git a/bitcoin/src/net.h b/bitcoin/src/net.h
@@ -26,8 +26,8 @@ inline unsigned int SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 10*1
static const unsigned int PUBLISH_HOPS = 5;
bool ConnectSocket(const CAddress& addrConnect, SOCKET& hSocketRet, int nTimeout=nConnectTimeout);
-bool Lookup(const char *pszName, std::vector<CAddress>& vaddr, int nServices, int nMaxSolutions, bool fAllowLookup = false, int portDefault = 0, bool fAllowPort = false);
-bool Lookup(const char *pszName, CAddress& addr, int nServices, bool fAllowLookup = false, int portDefault = 0, bool fAllowPort = false);
+bool Lookup(const char *pszName, std::vector<CAddress>& vaddr, int nServices, int nMaxSolutions, int portDefault = 0, bool fAllowPort = false);
+bool Lookup(const char *pszName, CAddress& addr, int nServices, int portDefault = 0, bool fAllowPort = false);
bool GetMyExternalIP(unsigned int& ipRet);
bool AddAddress(CAddress addr, int64 nTimePenalty=0, CAddrDB *pAddrDB=NULL);
void AddressCurrentlyConnected(const CAddress& addr);
diff --git a/bitcoin/src/protocol.cpp b/bitcoin/src/protocol.cpp
@@ -9,8 +9,8 @@
// Prototypes from net.h, but that header (currently) stinks, can't #include it without breaking things
-bool Lookup(const char *pszName, std::vector<CAddress>& vaddr, int nServices, int nMaxSolutions, bool fAllowLookup = false, int portDefault = 0, bool fAllowPort = false);
-bool Lookup(const char *pszName, CAddress& addr, int nServices, bool fAllowLookup = false, int portDefault = 0, bool fAllowPort = false);
+bool Lookup(const char *pszName, std::vector<CAddress>& vaddr, int nServices, int nMaxSolutions, int portDefault = 0, bool fAllowPort = false);
+bool Lookup(const char *pszName, CAddress& addr, int nServices, int portDefault = 0, bool fAllowPort = false);
static const unsigned char pchIPv4[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff };
static const char* ppszTypeName[] =
@@ -96,28 +96,28 @@ CAddress::CAddress(const struct sockaddr_in& sockaddr, uint64 nServicesIn)
nServices = nServicesIn;
}
-CAddress::CAddress(const char* pszIn, int portIn, bool fNameLookup, uint64 nServicesIn)
+CAddress::CAddress(const char* pszIn, int portIn, uint64 nServicesIn)
{
Init();
- Lookup(pszIn, *this, nServicesIn, fNameLookup, portIn);
+ Lookup(pszIn, *this, nServicesIn, portIn);
}
-CAddress::CAddress(const char* pszIn, bool fNameLookup, uint64 nServicesIn)
+CAddress::CAddress(const char* pszIn, uint64 nServicesIn)
{
Init();
- Lookup(pszIn, *this, nServicesIn, fNameLookup, 0, true);
+ Lookup(pszIn, *this, nServicesIn, 0, true);
}
-CAddress::CAddress(std::string strIn, int portIn, bool fNameLookup, uint64 nServicesIn)
+CAddress::CAddress(std::string strIn, int portIn, uint64 nServicesIn)
{
Init();
- Lookup(strIn.c_str(), *this, nServicesIn, fNameLookup, portIn);
+ Lookup(strIn.c_str(), *this, nServicesIn, portIn);
}
-CAddress::CAddress(std::string strIn, bool fNameLookup, uint64 nServicesIn)
+CAddress::CAddress(std::string strIn, uint64 nServicesIn)
{
Init();
- Lookup(strIn.c_str(), *this, nServicesIn, fNameLookup, 0, true);
+ Lookup(strIn.c_str(), *this, nServicesIn, 0, true);
}
void CAddress::Init()
diff --git a/bitcoin/src/protocol.h b/bitcoin/src/protocol.h
@@ -67,10 +67,10 @@ class CAddress
CAddress();
CAddress(unsigned int ipIn, unsigned short portIn=0, uint64 nServicesIn=NODE_NETWORK);
explicit CAddress(const struct sockaddr_in& sockaddr, uint64 nServicesIn=NODE_NETWORK);
- explicit CAddress(const char* pszIn, int portIn, bool fNameLookup = false, uint64 nServicesIn=NODE_NETWORK);
- explicit CAddress(const char* pszIn, bool fNameLookup = false, uint64 nServicesIn=NODE_NETWORK);
- explicit CAddress(std::string strIn, int portIn, bool fNameLookup = false, uint64 nServicesIn=NODE_NETWORK);
- explicit CAddress(std::string strIn, bool fNameLookup = false, uint64 nServicesIn=NODE_NETWORK);
+ explicit CAddress(const char* pszIn, int portIn, uint64 nServicesIn=NODE_NETWORK);
+ explicit CAddress(const char* pszIn, uint64 nServicesIn=NODE_NETWORK);
+ explicit CAddress(std::string strIn, int portIn, uint64 nServicesIn=NODE_NETWORK);
+ explicit CAddress(std::string strIn, uint64 nServicesIn=NODE_NETWORK);
void Init();