-
Notifications
You must be signed in to change notification settings - Fork 27
[Dynamic Neighbor]: add patch to support dynamic neighbor configuration. #14
Changes from all commits
706b450
e336deb
0461308
19f3be2
fa8d894
c21cb39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -439,6 +439,17 @@ bgp_stop (struct peer *peer) | |
safi_t safi; | ||
char orf_name[BUFSIZ]; | ||
|
||
if (peer_dynamic_neighbor(peer) && | ||
!(CHECK_FLAG(peer->flags, PEER_FLAG_DELETE))) | ||
{ | ||
if (BGP_DEBUG (events, EVENTS)) | ||
{ | ||
zlog_debug("BGP stop: %s (dynamic neighbor) deleted", peer->host); | ||
} | ||
peer_delete (peer); | ||
return -1; | ||
} | ||
|
||
/* Can't do this in Clearing; events are used for state transitions */ | ||
if (peer->status != Clearing) | ||
{ | ||
|
@@ -588,6 +599,17 @@ bgp_stop_with_error (struct peer *peer) | |
if (peer->v_start >= (60 * 2)) | ||
peer->v_start = (60 * 2); | ||
|
||
if (peer_dynamic_neighbor(peer)) | ||
{ | ||
if (BGP_DEBUG (events, EVENTS)) | ||
{ | ||
zlog_debug ("BGP stop with error: %s (dynamic neighbor) deleted", peer->host); | ||
} | ||
|
||
peer_delete (peer); | ||
return -1; | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this logic can be merged into bgp_stop() as bgp_stop already has similar logic. We should enable code re-use. |
||
bgp_stop (peer); | ||
|
||
return 0; | ||
|
@@ -609,6 +631,17 @@ bgp_stop_with_notify (struct peer *peer, u_char code, u_char sub_code) | |
return -1; | ||
} | ||
|
||
if (peer_dynamic_neighbor(peer)) | ||
{ | ||
if (BGP_DEBUG (events, EVENTS)) | ||
{ | ||
zlog_debug ("BGP stop with notify: %s (dynamic neighbor) deleted", peer->host); | ||
} | ||
|
||
peer_delete (peer); | ||
return -1; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should move into bgp_stop() |
||
|
||
/* Clear start timer value to default. */ | ||
peer->v_start = BGP_INIT_START_TIMER; | ||
|
||
|
@@ -656,6 +689,17 @@ bgp_connect_success (struct peer *peer) | |
static int | ||
bgp_connect_fail (struct peer *peer) | ||
{ | ||
if (peer_dynamic_neighbor(peer)) | ||
{ | ||
if (BGP_DEBUG (events, EVENTS)) | ||
{ | ||
zlog_debug ("BGP connection fail: %s (dynamic neighbor) deleted", peer->host); | ||
} | ||
|
||
peer_delete (peer); | ||
return -1; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move into bgp_stop(). |
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same code 4 times. Probably it's better to introduce a static function here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code is used to provide log info if debug_event is enabled. They are not exactly the same. So adding more detailed log info now for better troubleshooting. |
||
bgp_stop (peer); | ||
return 0; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> zlog_info
check line 467: neighbor down event is logged as info level, this is also neighbor down event, should also logged as info level.