diff options
Diffstat (limited to 'testing/namecoin/12-fix-miniupnpc.patch')
-rw-r--r-- | testing/namecoin/12-fix-miniupnpc.patch | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/testing/namecoin/12-fix-miniupnpc.patch b/testing/namecoin/12-fix-miniupnpc.patch new file mode 100644 index 0000000000..c911f0a8b0 --- /dev/null +++ b/testing/namecoin/12-fix-miniupnpc.patch @@ -0,0 +1,61 @@ +--- namecoin-nc0.3.75/src/net.cpp ++++ namecoin-nc0.3.75/src/net.cpp.new +@@ -19,10 +19,10 @@ + #endif + + #ifdef USE_UPNP +-#include <miniwget.h> +-#include <miniupnpc.h> +-#include <upnpcommands.h> +-#include <upnperrors.h> ++#include <miniupnpc/miniwget.h> ++#include <miniupnpc/miniupnpc.h> ++#include <miniupnpc/upnpcommands.h> ++#include <miniupnpc/upnperrors.h> + #endif + + using namespace std; +@@ -1088,8 +1088,7 @@ + { + printf("ThreadMapPort started\n"); + +- char port[6]; +- sprintf(port, "%d", GetListenPort()); ++ std::string port = strprintf("%u", GetListenPort()); + + const char * rootdescurl = 0; + const char * multicastif = 0; +@@ -1113,25 +1112,26 @@ + r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr)); + if (r == 1) + { +- char intClient[16]; +- char intPort[6]; ++ string strDesc = "Namecoin " + FormatFullVersion(); + +-#if !defined(__WXMSW__) && !defined(MAC_OSX) ++#ifndef UPNPDISCOVER_SUCCESS ++ /* miniupnpc 1.5 */ + r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, +- port, port, lanaddr, 0, "TCP", 0); ++ port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0); + #else ++ /* miniupnpc 1.6 */ + r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, +- port, port, lanaddr, 0, "TCP", 0, "0"); ++ port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0, "0"); + #endif + if(r!=UPNPCOMMAND_SUCCESS) + printf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n", +- port, port, lanaddr, r, strupnperror(r)); ++ port.c_str(), port.c_str(), lanaddr, r, strupnperror(r)); + else + printf("UPnP Port Mapping successful.\n"); + loop { + if (fShutdown || !fUseUPnP) + { +- r = UPNP_DeletePortMapping(urls.controlURL, data.first.servicetype, port, "TCP", 0); ++ r = UPNP_DeletePortMapping(urls.controlURL, data.first.servicetype, port.c_str(), "TCP", 0); + printf("UPNP_DeletePortMapping() returned : %d\n", r); + freeUPNPDevlist(devlist); devlist = 0; + FreeUPNPUrls(&urls); |