From 6526dd6c4bd21ad4451eecfff6b5b41c81046cd9 Mon Sep 17 00:00:00 2001 From: drbob Date: Sun, 19 Jan 2014 06:25:49 +0000 Subject: [PATCH] Tweaked linkmgr to allow loopback connections. This allows STD -> HIDDEN connections! git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-initdev@7037 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/pqi/p3linkmgr.cc | 14 +++++++++++++- libretroshare/src/pqi/pqisslpersongrp.cc | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/pqi/p3linkmgr.cc b/libretroshare/src/pqi/p3linkmgr.cc index 1557b0498..c18030b75 100644 --- a/libretroshare/src/pqi/p3linkmgr.cc +++ b/libretroshare/src/pqi/p3linkmgr.cc @@ -1709,7 +1709,7 @@ bool p3LinkMgrIMPL::locked_CheckPotentialAddr(const struct sockaddr_storage &ad } bool isValid = sockaddr_storage_isValidNet(addr); - // bool isLoopback = sockaddr_storage_isLoopbackNet(addr); + bool isLoopback = sockaddr_storage_isLoopbackNet(addr); // bool isPrivate = sockaddr_storage_isPrivateNet(addr); bool isExternal = sockaddr_storage_isExternalNet(addr); @@ -1753,6 +1753,18 @@ bool p3LinkMgrIMPL::locked_CheckPotentialAddr(const struct sockaddr_storage &ad } + /* if loopback, then okay - probably proxy connection (or local testing). + */ + if (isLoopback) + { +#ifdef LINKMGR_DEBUG + std::cerr << "p3LinkMgrIMPL::locked_CheckPotentialAddr() ACCEPTING - LOOPBACK"; + std::cerr << std::endl; +#endif + return true; + } + + /* get here, it is private or loopback * - can only connect to these addresses if we are on the same subnet. - check net against our local address. diff --git a/libretroshare/src/pqi/pqisslpersongrp.cc b/libretroshare/src/pqi/pqisslpersongrp.cc index a0fdb6733..12f654fbd 100644 --- a/libretroshare/src/pqi/pqisslpersongrp.cc +++ b/libretroshare/src/pqi/pqisslpersongrp.cc @@ -76,7 +76,8 @@ pqiperson * pqisslpersongrp::locked_createPerson(std::string id, pqilistener *li pqiperson *pqip = new pqiperson(id, this); // If using proxy, then only create a proxy item, otherwise can use any. - if (mPeerMgr->isHiddenPeer(id)) + // If we are a hidden node - then all connections should be via proxy. + if (mPeerMgr->isHiddenPeer(id) || mPeerMgr->isHidden()) { std::cerr << "pqisslpersongrp::locked_createPerson() Is Hidden Peer!"; std::cerr << std::endl;