Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor how config routes are deleted from outgoing RIB to handle offline routers #1128

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Version explained:
- bug : increase on bug or incremental changes

Version 4.2.22
* Fix: route reload for offline neighbors #1126
patch: Malcolm Dodds

Version 4.2.21
* Fix: regressing on announcing routes from the API #1108
Expand Down
5 changes: 3 additions & 2 deletions lib/exabgp/bgp/neighbor.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ def __init__(self):

# The routes we have parsed from the configuration
self.changes = []
# On signal update, the previous routes so we can compare what changed
self.backup_changes = []

self.operational = None
self.eor = deque()
Expand Down Expand Up @@ -197,6 +195,9 @@ def remove_addpath(self, family):
if family in self.addpaths():
self._addpath.remove(family)

def process_previous_changes(self, previous_changes):
self.rib.outgoing.replace(previous_changes, self.changes)

def missing(self):
if self.local_address is None and not self.auto_discovery:
return 'local-address'
Expand Down
4 changes: 2 additions & 2 deletions lib/exabgp/configuration/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,10 @@ def _commit_reload(self):
self.processes = self.process.processes
self._neighbors = {}

# Add the changes prior to the reload to the neighbor to correct handling of deleted routes
# Withdraw any old changes
for neighbor in self.neighbors:
if neighbor in self._previous_neighbors:
self.neighbors[neighbor].backup_changes = self._previous_neighbors[neighbor].changes
self.neighbors[neighbor].process_previous_changes(self._previous_neighbors[neighbor].changes)

self._previous_neighbors = {}
self._cleanup()
Expand Down
7 changes: 0 additions & 7 deletions lib/exabgp/reactor/peer.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,13 +482,6 @@ def _main(self):
if self._reconfigure:
self._reconfigure = False

# we are here following a configuration change
if self._neighbor:
# see what changed in the configuration
self.neighbor.rib.outgoing.replace(self._neighbor.backup_changes, self._neighbor.changes)
# do not keep the previous routes in memory as they are not useful anymore
self._neighbor.backup_changes = []

# Take the routes already sent to that peer and resend them
if self._resend_routes != SEND.DONE:
enhanced = True if refresh_enhanced and self._resend_routes == SEND.REFRESH else False
Expand Down
7 changes: 5 additions & 2 deletions lib/exabgp/rib/outgoing.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,12 @@ def queued_changes(self):
yield change

def replace(self, previous, changes):
nlri = [c.nlri for c in changes]

for change in previous:
change.nlri.action = OUT.WITHDRAW
self.add_to_rib(change, True)
if change.nlri not in nlri:
change.nlri.action = OUT.WITHDRAW
self.add_to_rib(change, True)

for change in changes:
self.add_to_rib(change, True)
Expand Down