From 05a0a20197cc9e4e176a16820ab672f20815fce4 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Wed, 8 Dec 2021 14:32:58 -0800 Subject: [PATCH] Fix multipath flow reallocation. Prevent allocation to dead paths --- node/Bond.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/node/Bond.cpp b/node/Bond.cpp index f294eb431..62adcf5fd 100644 --- a/node/Bond.cpp +++ b/node/Bond.cpp @@ -894,13 +894,13 @@ void Bond::curateBond(int64_t now, bool rebuildBond) if (! currEligibility) { _paths[i].adjustRefractoryPeriod(now, _defaultPathRefractoryPeriod, ! currEligibility); if (_paths[i].bonded) { - _paths[i].bonded = false; if (_allowFlowHashing) { _paths[i].p->address().toString(pathStr); log("link %s/%s was bonded, flow reallocation will occur soon", getLink(_paths[i].p)->ifname().c_str(), pathStr); rebuildBond = true; _paths[i].shouldReallocateFlows = _paths[i].bonded; } + _paths[i].bonded = false; } } } @@ -979,7 +979,7 @@ void Bond::curateBond(int64_t now, bool rebuildBond) if (ipvPref == 0) { for (int j = 0; j < it->second.size(); j++) { int idx = it->second.at(j); - if (! _paths[idx].p || ! _paths[idx].allowed()) { + if (! _paths[idx].p || ! _paths[idx].eligible || ! _paths[idx].allowed()) { continue; } addPathToBond(idx, updatedBondedPathCount); @@ -992,7 +992,7 @@ void Bond::curateBond(int64_t now, bool rebuildBond) if (ipvPref == 4 || ipvPref == 6) { for (int j = 0; j < it->second.size(); j++) { int idx = it->second.at(j); - if (! _paths[idx].p) { + if (! _paths[idx].p || ! _paths[idx].eligible) { continue; } if (! _paths[idx].allowed()) { @@ -1000,9 +1000,6 @@ void Bond::curateBond(int64_t now, bool rebuildBond) log("did not add %s/%s (user addr preference %d)", link->ifname().c_str(), pathStr, ipvPref); continue; } - if (! _paths[idx].eligible) { - continue; - } addPathToBond(idx, updatedBondedPathCount); ++updatedBondedPathCount; _paths[idx].p->address().toString(pathStr); @@ -1016,10 +1013,10 @@ void Bond::curateBond(int64_t now, bool rebuildBond) // Search for preferred paths for (int j = 0; j < it->second.size(); j++) { int idx = it->second.at(j); - if (! _paths[idx].p || ! _paths[idx].eligible) { + if (! _paths[idx].p || ! _paths[idx].eligible || ! _paths[idx].allowed()) { continue; } - if (_paths[idx].preferred() && _paths[idx].allowed()) { + if (_paths[idx].preferred()) { addPathToBond(idx, updatedBondedPathCount); ++updatedBondedPathCount; _paths[idx].p->address().toString(pathStr);