Exemple #1
0
void NeighborUpdater::stateUpdated(const StateDelta& delta) {
  CHECK(sw_->getUpdateEVB()->inRunningEventBaseThread());
  for (const auto& entry : delta.getVlansDelta()) {
    sendNeighborUpdates(entry);
    auto oldEntry = entry.getOld();
    auto newEntry = entry.getNew();

    if (!newEntry) {
      vlanDeleted(oldEntry.get());
    } else if (!oldEntry) {
      vlanAdded(delta.newState().get(), newEntry.get());
    } else {
      vlanChanged(oldEntry.get(), newEntry.get());
    }
  }

  const auto& oldState = delta.oldState();
  const auto& newState = delta.newState();
  if (oldState->getArpTimeout() != newState->getArpTimeout() ||
      oldState->getNdpTimeout() != newState->getNdpTimeout() ||
      oldState->getMaxNeighborProbes() != newState->getMaxNeighborProbes() ||
      oldState->getStaleEntryInterval() != newState->getStaleEntryInterval()) {
    std::lock_guard<std::mutex> g(cachesMutex_);
    for (auto& vlanAndCaches : caches_) {
      auto& arpCache = vlanAndCaches.second->arpCache;
      auto& ndpCache = vlanAndCaches.second->ndpCache;
      arpCache->setTimeout(newState->getArpTimeout());
      arpCache->setMaxNeighborProbes(newState->getMaxNeighborProbes());
      arpCache->setStaleEntryInterval(newState->getStaleEntryInterval());
      ndpCache->setTimeout(newState->getNdpTimeout());
      ndpCache->setMaxNeighborProbes(newState->getMaxNeighborProbes());
      ndpCache->setStaleEntryInterval(newState->getStaleEntryInterval());
    }
  }
}
Exemple #2
0
void NeighborUpdater::stateUpdated(const StateDelta& delta) {
  CHECK(sw_->getUpdateEVB()->inRunningEventBaseThread());
  for (const auto& entry : delta.getVlansDelta()) {
    sendNeighborUpdates(entry);
    auto oldEntry = entry.getOld();
    auto newEntry = entry.getNew();

    if (!newEntry) {
      vlanDeleted(oldEntry.get());
    } else if (!oldEntry) {
      vlanAdded(delta.newState().get(), newEntry.get());
    } else {
      vlanChanged(oldEntry.get(), newEntry.get());
    }
  }
  unresolvedNhopsProber_->stateChanged(delta);
}