tree checksum vpatch file split hunks

all signers: mircea_popescu trinque asciilifeform ben_vulpes mod6

antecedents: asciilifeform_zap_hardcoded_seeds

press order:

genesisasciilifeform ben_vulpes mircea_popescu mod6 trinque
bitcoin-asciilifeform.1asciilifeform ben_vulpes mod6
rm_rf_upnpasciilifeform ben_vulpes mod6
bitcoin-asciilifeform.3-turdmeister-alert-snipasciilifeform ben_vulpes mod6
bitcoin-asciilifeform.2-https_snipsnipasciilifeform ben_vulpes mod6
bitcoin-asciilifeform.4-goodbye-win32asciilifeform ben_vulpes mod6
asciilifeform_dnsseed_snipsnipasciilifeform ben_vulpes mod6
asciilifeform_zap_hardcoded_seedsasciilifeform ben_vulpes mod6
asciilifeform_zap_showmyip_crudasciilifeform ben_vulpes mod6

patch:

- 4F7D9AB0F1B1C8C63112FDEAE55038D6C1CE96D4EE8D791803B02F77507239FA721384ECE65B747C56279D5B6A493D79F547B13A8C94EEBAA1D55FB07ABA3215
+ E49A09443EB1AAF45252696F1731C346C18EFA2FBC3B64D87EDA63E126CC4DD44608B9C554C80DCD112EC5A050CF5A937B6A302D03DCA89C8543F03CEFBFA17C
bitcoin/src/net.cpp
(263 . 114)(263 . 6)
5 return fRet;
6 }
7
8 bool GetMyExternalIP2(const CAddress& addrConnect, const char* pszGet, const char* pszKeyword, unsigned int& ipRet)
9 {
10 SOCKET hSocket;
11 if (!ConnectSocket(addrConnect, hSocket))
12 return error("GetMyExternalIP() : connection to %s failed", addrConnect.ToString().c_str());
13
14 send(hSocket, pszGet, strlen(pszGet), MSG_NOSIGNAL);
15
16 string strLine;
17 while (RecvLine(hSocket, strLine))
18 {
19 if (strLine.empty()) // HTTP response is separated from headers by blank line
20 {
21 loop
22 {
23 if (!RecvLine(hSocket, strLine))
24 {
25 closesocket(hSocket);
26 return false;
27 }
28 if (pszKeyword == NULL)
29 break;
30 if (strLine.find(pszKeyword) != -1)
31 {
32 strLine = strLine.substr(strLine.find(pszKeyword) + strlen(pszKeyword));
33 break;
34 }
35 }
36 closesocket(hSocket);
37 if (strLine.find("<") != -1)
38 strLine = strLine.substr(0, strLine.find("<"));
39 strLine = strLine.substr(strspn(strLine.c_str(), " \t\n\r"));
40 while (strLine.size() > 0 && isspace(strLine[strLine.size()-1]))
41 strLine.resize(strLine.size()-1);
42 CAddress addr(strLine,0,true);
43 printf("GetMyExternalIP() received [%s] %s\n", strLine.c_str(), addr.ToString().c_str());
44 if (addr.ip == 0 || addr.ip == INADDR_NONE || !addr.IsRoutable())
45 return false;
46 ipRet = addr.ip;
47 return true;
48 }
49 }
50 closesocket(hSocket);
51 return error("GetMyExternalIP() : connection closed");
52 }
53
54 // We now get our external IP from the IRC server first and only use this as a backup
55 bool GetMyExternalIP(unsigned int& ipRet)
56 {
57 CAddress addrConnect;
58 const char* pszGet;
59 const char* pszKeyword;
60
61 if (fUseProxy)
62 return false;
63
64 for (int nLookup = 0; nLookup <= 1; nLookup++)
65 for (int nHost = 1; nHost <= 2; nHost++)
66 {
67 // We should be phasing out our use of sites like these. If we need
68 // replacements, we should ask for volunteers to put this simple
69 // php file on their webserver that prints the client IP:
70 // <?php echo $_SERVER["REMOTE_ADDR"]; ?>
71 if (nHost == 1)
72 {
73 addrConnect = CAddress("91.198.22.70",80); // checkip.dyndns.org
74
75 if (nLookup == 1)
76 {
77 CAddress addrIP("checkip.dyndns.org", 80, true);
78 if (addrIP.IsValid())
79 addrConnect = addrIP;
80 }
81
82 pszGet = "GET / HTTP/1.1\r\n"
83 "Host: checkip.dyndns.org\r\n"
84 "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n"
85 "Connection: close\r\n"
86 "\r\n";
87
88 pszKeyword = "Address:";
89 }
90 else if (nHost == 2)
91 {
92 addrConnect = CAddress("74.208.43.192", 80); // www.showmyip.com
93
94 if (nLookup == 1)
95 {
96 CAddress addrIP("www.showmyip.com", 80, true);
97 if (addrIP.IsValid())
98 addrConnect = addrIP;
99 }
100
101 pszGet = "GET /simple/ HTTP/1.1\r\n"
102 "Host: www.showmyip.com\r\n"
103 "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n"
104 "Connection: close\r\n"
105 "\r\n";
106
107 pszKeyword = NULL; // Returns just IP address
108 }
109
110 if (GetMyExternalIP2(addrConnect, pszGet, pszKeyword, ipRet))
111 return true;
112 }
113
114 return false;
115 }
116
117 void ThreadGetMyExternalIP(void* parg)
118 {
(386 . 26)(278 . 10)
120 }
121
122 // Fallback in case IRC fails to get it
123 if (GetMyExternalIP(addrLocalHost.ip))
124 {
125 printf("GetMyExternalIP() returned %s\n", addrLocalHost.ToStringIP().c_str());
126 if (addrLocalHost.IsRoutable())
127 {
128 // If we already connected to a few before we had our IP, go back and addr them.
129 // setAddrKnown automatically filters any duplicate sends.
130 CAddress addr(addrLocalHost);
131 addr.nTime = GetAdjustedTime();
132 CRITICAL_BLOCK(cs_vNodes)
133 BOOST_FOREACH(CNode* pnode, vNodes)
134 pnode->PushAddress(addr);
135 }
136 }
137 // ... nope.
138 }
139
140
141
142
143
144 bool AddAddress(CAddress addr, int64 nTimePenalty, CAddrDB *pAddrDB)
145 {
146 if (!addr.IsRoutable())