|
@@ -1632,6 +1632,18 @@ public:
|
|
|
const InetAddress *const target = reinterpret_cast<const InetAddress *>(&(n.config.routes[i].target));
|
|
|
const InetAddress *const via = reinterpret_cast<const InetAddress *>(&(n.config.routes[i].via));
|
|
|
|
|
|
+ InetAddress *src = NULL;
|
|
|
+ for (unsigned int j=0; j<n.config.assignedAddressCount; ++j) {
|
|
|
+ const InetAddress *const tmp = reinterpret_cast<const InetAddress *>(&(n.config.assignedAddresses[j]));
|
|
|
+ if (target->isV4() && tmp->isV4()) {
|
|
|
+ src = reinterpret_cast<InetAddress *>(&(n.config.assignedAddresses[j]));
|
|
|
+ break;
|
|
|
+ } else if (target->isV6() && tmp->isV6()) {
|
|
|
+ src = reinterpret_cast<InetAddress *>(&(n.config.assignedAddresses[j]));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if ( (!checkIfManagedIsAllowed(n,*target)) || ((via->ss_family == target->ss_family)&&(matchIpOnly(myIps,*via))) )
|
|
|
continue;
|
|
|
|
|
@@ -1659,7 +1671,7 @@ public:
|
|
|
continue;
|
|
|
|
|
|
// Add and apply new routes
|
|
|
- n.managedRoutes.push_back(SharedPtr<ManagedRoute>(new ManagedRoute(*target,*via,tapdev)));
|
|
|
+ n.managedRoutes.push_back(SharedPtr<ManagedRoute>(new ManagedRoute(*target,*via,*src,tapdev)));
|
|
|
if (!n.managedRoutes.back()->sync())
|
|
|
n.managedRoutes.pop_back();
|
|
|
#endif
|
|
@@ -1922,7 +1934,7 @@ public:
|
|
|
inline void phyOnUnixAccept(PhySocket *sockL,PhySocket *sockN,void **uptrL,void **uptrN) {}
|
|
|
inline void phyOnUnixClose(PhySocket *sock,void **uptr) {}
|
|
|
inline void phyOnUnixData(PhySocket *sock,void **uptr,void *data,unsigned long len) {}
|
|
|
- inline void phyOnUnixWritable(PhySocket *sock,void **uptr,bool lwip_invoked) {}
|
|
|
+ inline void phyOnUnixWritable(PhySocket *sock,void **uptr) {}
|
|
|
|
|
|
inline int nodeVirtualNetworkConfigFunction(uint64_t nwid,void **nuptr,enum ZT_VirtualNetworkConfigOperation op,const ZT_VirtualNetworkConfig *nwc)
|
|
|
{
|