summaryrefslogtreecommitdiff
path: root/osdep/RoutingTable.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2016-04-06 17:29:38 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2016-04-06 17:29:38 -0700
commitc278f051817719fc3c4bbda0e13c279ce44f0966 (patch)
treebc6d367aa2f84121701fce49e83abf3edce20d15 /osdep/RoutingTable.cpp
parent61a9c27af08dcf1035854ead098566b644983c90 (diff)
downloadinfinitytier-c278f051817719fc3c4bbda0e13c279ce44f0966.tar.gz
infinitytier-c278f051817719fc3c4bbda0e13c279ce44f0966.zip
RoutingTable build fixes.
Diffstat (limited to 'osdep/RoutingTable.cpp')
-rw-r--r--osdep/RoutingTable.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/osdep/RoutingTable.cpp b/osdep/RoutingTable.cpp
index a639f630..40523898 100644
--- a/osdep/RoutingTable.cpp
+++ b/osdep/RoutingTable.cpp
@@ -16,9 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef ZT_ROUTINGTABLE_HPP
-#define ZT_ROUTINGTABLE_HPP
-
#include "../node/Constants.hpp"
#ifdef __WINDOWS__
@@ -308,7 +305,7 @@ std::vector<RoutingTable::Entry> RoutingTable::get(bool includeLinkLocal,bool in
sin6->sin6_scope_id = interfaceIndex;
}
}
- e.destination.set(sa);
+ e.destination = *sa;
break;
case 1:
//printf("RTA_GATEWAY\n");
@@ -318,7 +315,7 @@ std::vector<RoutingTable::Entry> RoutingTable::get(bool includeLinkLocal,bool in
break;
case AF_INET:
case AF_INET6:
- e.gateway.set(sa);
+ e.gateway = *sa;
break;
}
break;
@@ -371,7 +368,8 @@ std::vector<RoutingTable::Entry> RoutingTable::get(bool includeLinkLocal,bool in
if (e.metric < 0)
e.metric = 0;
- if (((includeLinkLocal)||(!e.destination.isLinkLocal()))&&((includeLoopback)||((!e.destination.isLoopback())&&(!e.gateway.isLoopback()))))
+ InetAddress::IpScope dscope = e.destination.ipScope();
+ if ( ((includeLinkLocal)||(dscope != InetAddress::IP_SCOPE_LINK_LOCAL)) && ((includeLoopback)||((dscope != InetAddress::IP_SCOPE_LOOPBACK) && (e.gateway.ipScope() != InetAddress::IP_SCOPE_LOOPBACK) )))
entries.push_back(e);
}
@@ -391,7 +389,7 @@ std::vector<RoutingTable::Entry> RoutingTable::get(bool includeLinkLocal,bool in
if ((!e1->device[0])&&(e1->gateway)) {
int bestMetric = 9999999;
for(std::vector<ZeroTier::RoutingTable::Entry>::iterator e2(entries.begin());e2!=entries.end();++e2) {
- if ((e1->gateway.within(e2->destination))&&(e2->metric <= bestMetric)) {
+ if ((e2->destination.containsAddress(e1->gateway))&&(e2->metric <= bestMetric)) {
bestMetric = e2->metric;
Utils::scopy(e1->device,sizeof(e1->device),e2->device);
}
@@ -608,5 +606,3 @@ RoutingTable::Entry RoutingTable::set(const InetAddress &destination,const InetA
// ---------------------------------------------------------------------------
} // namespace ZeroTier
-
-#endif