-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
More found connection conversion issues #17385
More found connection conversion issues #17385
Conversation
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.
looks good
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
f99d54e
to
e3f24e5
Compare
bgpd/bgpd.c
Outdated
void peer_notify_unconfig(struct peer_connection *connection) | ||
{ | ||
if (BGP_IS_VALID_STATE_FOR_NOTIF(connection->status)) | ||
bgp_notify_send(connection, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); |
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.
This should be BGP_NOTIFY_CEASE_PEER_UNCONFIG, right?
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.
yes I got it backwards, fixed
bgpd/bgpd.c
Outdated
bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE, | ||
BGP_NOTIFY_CEASE_PEER_UNCONFIG); | ||
if (BGP_IS_VALID_STATE_FOR_NOTIF(connection->status)) { | ||
bgp_notify_send(connection, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_PEER_UNCONFIG); |
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.
Here it should be BGP_NOTIFY_CEASE_CONFIG_CHANGE, right?
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.
fixed
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
e3f24e5
to
d1772d6
Compare
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.
I see still lots of places where BGP_IS_VALID_STATE_FOR_NOTIF()
is called, but it's actually called also in peer_notify_config_change()
, correct?
bgpd/bgpd.c
Outdated
@@ -7057,8 +7006,7 @@ int peer_password_unset(struct peer *peer) | |||
|
|||
/* Send notification or reset peer depending on state. */ | |||
if (BGP_IS_VALID_STATE_FOR_NOTIF(member->connection->status)) |
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.
peer_notify_config_change() already do this check, right?
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.
fixed them all
bgpd/bgpd.c
Outdated
@@ -7030,8 +6980,7 @@ int peer_password_unset(struct peer *peer) | |||
if (!CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) { | |||
/* Send notification or reset peer depending on state. */ | |||
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status)) |
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.
peer_notify_config_change() already do this check, right?
bgpd/bgpd.c
Outdated
@@ -6984,8 +6935,7 @@ int peer_password_set(struct peer *peer, const char *password) | |||
member->last_reset = PEER_DOWN_PASSWORD_CHANGE; | |||
/* Send notification or reset peer depending on state. */ | |||
if (BGP_IS_VALID_STATE_FOR_NOTIF(member->connection->status)) |
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.
peer_notify_config_change() already do this check, right?
bgpd/bgpd.c
Outdated
@@ -6946,8 +6898,7 @@ int peer_password_set(struct peer *peer, const char *password) | |||
peer->last_reset = PEER_DOWN_PASSWORD_CHANGE; | |||
/* Send notification or reset peer depending on state. */ | |||
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status)) |
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.
peer_notify_config_change() already do this check, right?
bgpd/bgpd.c
Outdated
@@ -6914,8 +6867,7 @@ int peer_local_as_unset(struct peer *peer) | |||
|
|||
/* Send notification or stop peer depending on state. */ | |||
if (BGP_IS_VALID_STATE_FOR_NOTIF(member->connection->status)) |
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.
Ditto.
bgpd/bgpd.c
Outdated
@@ -5852,8 +5807,7 @@ void peer_update_source_unset(struct peer *peer) | |||
|
|||
/* Send notification or reset peer depending on state. */ | |||
if (BGP_IS_VALID_STATE_FOR_NOTIF(member->connection->status)) |
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.
Ditto.
bgpd/bgpd.c
Outdated
@@ -5816,8 +5772,7 @@ void peer_update_source_unset(struct peer *peer) | |||
peer->last_reset = PEER_DOWN_UPDATE_SOURCE_CHANGE; | |||
/* Send notification or reset peer depending on state. */ | |||
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status)) |
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.
Ditto.
bgpd/bgpd.c
Outdated
@@ -5765,8 +5722,7 @@ void peer_update_source_addr_set(struct peer *peer, const union sockunion *su) | |||
|
|||
/* Send notification or reset peer depending on state. */ | |||
if (BGP_IS_VALID_STATE_FOR_NOTIF(member->connection->status)) |
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.
Ditto.
bgpd/bgpd.c
Outdated
@@ -5427,9 +5392,7 @@ int peer_ebgp_multihop_set(struct peer *peer, int ttl) | |||
if (peer->sort != BGP_PEER_IBGP) { | |||
if (BGP_IS_VALID_STATE_FOR_NOTIF( |
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.
Ditto.
d1772d6
to
1bdce30
Compare
bgpd/bgpd.c
Outdated
bgp_notify_send(member->connection, BGP_NOTIFY_CEASE, | ||
BGP_NOTIFY_CEASE_CONFIG_CHANGE); | ||
else | ||
if (peer_notify_config_change(peer->connection)) |
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.
!peer_notify_config_change()
:)
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.
fixed
1bdce30
to
90f78f6
Compare
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.
LGTM
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Convert this function to being connection based. Signed-off-by: Donald Sharp <[email protected]>
We have about a bajillion tests of if we can notify the peer and then we send a config change notification. Let's just make a function that does this. Signed-off-by: Donald Sharp <[email protected]>
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status)) peer_notify_config_change(peer->connection); else bgp_session_reset_safe(peer, &nnode); Let's add a bool return to peer_notify_config_change of whether or not it should call the peer session reset. This simplifies the code a bunch. Signed-off-by: Donald Sharp <[email protected]>
Signed-off-by: Donald Sharp <[email protected]>
Signed-off-by: Donald Sharp <[email protected]>
Let's use the connection associated with the peer instead. Signed-off-by: Donald Sharp <[email protected]>
Signed-off-by: Donald Sharp <[email protected]>
90f78f6
to
7bf3f53
Compare
I have started another round of converting the
struct peer
doppelganger away and found some more functions that should properly be connection oriented. Move them over. I also made some code changes to make the coding pattern in bgp to be a bit better.