Merge branch 'rtnetlink' into edge
This commit is contained in:
@@ -1710,11 +1710,13 @@ public:
|
||||
// Nuke applied routes that are no longer in n.config.routes[] and/or are not allowed
|
||||
for(std::list< SharedPtr<ManagedRoute> >::iterator mr(n.managedRoutes.begin());mr!=n.managedRoutes.end();) {
|
||||
bool haveRoute = false;
|
||||
|
||||
if ( (checkIfManagedIsAllowed(n,(*mr)->target())) && (((*mr)->via().ss_family != (*mr)->target().ss_family)||(!matchIpOnly(myIps,(*mr)->via()))) ) {
|
||||
for(unsigned int i=0;i<n.config.routeCount;++i) {
|
||||
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));
|
||||
if ( ((*mr)->target() == *target) && ( ((via->ss_family == target->ss_family)&&((*mr)->via().ipsEqual(*via))) || (tapdev == (*mr)->device()) ) ) {
|
||||
|
||||
if ( ((*mr)->target() == *target) && ( ((via->ss_family == target->ss_family)&&((*mr)->via().ipsEqual(*via))) || (strcmp(tapdev,(*mr)->device())==0) ) ) {
|
||||
haveRoute = true;
|
||||
break;
|
||||
}
|
||||
@@ -1731,6 +1733,17 @@ public:
|
||||
for(unsigned int i=0;i<n.config.routeCount;++i) {
|
||||
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;
|
||||
@@ -1762,7 +1775,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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user