Skip to content

Commit

Permalink
comments to be nice with future-self
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-mangin committed Mar 29, 2023
1 parent be39889 commit ff4ad89
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/exabgp/bgp/neighbor.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ def ip_self(self, afi):
% (afi, self['local-address'].afi)
)

# NOTE: this may very well modify the change object passed to the function
def remove_self(self, change):
if not change.nlri.nexthop.SELF:
return change
Expand Down
1 change: 1 addition & 0 deletions src/exabgp/configuration/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def inject_change(self, peers, change):
if neighbor_name in peers:
neighbor = self.neighbors[neighbor_name]
if change.nlri.family() in neighbor.families():
# remove_self may well have side effects on change
neighbor.rib.outgoing.add_to_rib(neighbor.remove_self(change))
else:
log.error('the route family is not configured on neighbor', 'configuration')
Expand Down
4 changes: 4 additions & 0 deletions src/exabgp/configuration/neighbor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,23 +238,27 @@ def _post_routes(self, neighbor, local):

neighbor.changes = []
for change in self.scope.pop_routes():
# remove_self may well have side effects on change
neighbor.changes.append(neighbor.remove_self(change))

# old format
for section in ('static', 'l2vpn', 'flow'):
routes = local.get(section, {}).get('routes', [])
for route in routes:
route.nlri.action = Action.ANNOUNCE
# remove_self may well have side effects on change
neighbor.changes.append(neighbor.remove_self(route))

routes = local.get('routes', [])
for route in routes:
route.nlri.action = Action.ANNOUNCE
# remove_self may well have side effects on change
neighbor.changes.append(neighbor.remove_self(route))

def _init_neighbor(self, neighbor, local):
families = neighbor.families()
for change in neighbor.changes:
# remove_self may well have side effects on change
change = neighbor.remove_self(change)
if change.nlri.family() in families:
# This add the family to neighbor.families()
Expand Down

0 comments on commit ff4ad89

Please sign in to comment.