Skip to content

Commit

Permalink
better next-hop self check #1153
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-mangin committed Mar 29, 2023
1 parent 9828166 commit 583d473
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Version explained:
Version 4.2.22
* Fix: route reload for offline neighbors #1126
patch: Malcolm Dodds
* Fix: make sure we compare next-hop self and next-hop IP correctly (#1153)
reported: gitneep

Version 4.2.21
* Fix: regressing on announcing routes from the API #1108
Expand Down
2 changes: 1 addition & 1 deletion etc/exabgp/run/api-nexthop-self.run
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import time
messages = [
'neighbor 127.0.0.1 announce route 1.1.0.0/16 next-hop self',
'announce route 2.2.0.0/16 next-hop self',
'announce route 2.2.0.1/32 next-hop self',
'announce route 2.2.0.1/32 next-hop 127.0.0.1',
'announce route 2.2.0.1/32 next-hop self',
'announce route 2.2.0.1/32 next-hop self',
'announce route 3.3.0.3/32 next-hop self', # Non duplicate route, signals server that test is over
Expand Down
6 changes: 6 additions & 0 deletions lib/exabgp/bgp/message/update/attribute/nexthop.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ def __repr__(self):


class NextHopSelf(NextHop):
ID = Attribute.CODE.NEXT_HOP
FLAG = Attribute.Flag.TRANSITIVE
CACHING = True
SELF = True

def __init__(self, afi):
Expand All @@ -69,3 +72,6 @@ def pack(self, negotiated):

def ton(self, negotiated=None, afi=AFI.undefined):
return negotiated.nexthopself(afi).ton()

def __eq__(self, other):
return self.ID == other.ID and self.FLAG == other.FLAG and self.ton() == other.ton()
2 changes: 1 addition & 1 deletion qa/sbin/bgp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ class BGPHandler(asyncore.dispatcher_with_send):
elif self.messages:
message = self.messages[0].upper()
if message.startswith('F' * 32):
self.announce('expected : %s:%s:%s' % (message[:32], message[32:38], message[38:]))
self.announce('expected : %s:%s:%s:%s' % (message[:32], message[32:36], message[36:38], message[38:]))
else:
self.announce('expected : %s' % message)
else:
Expand Down

0 comments on commit 583d473

Please sign in to comment.