Skip to content

Commit 3e5a31b

Browse files
committed
bgpd: Convert struct peer_connection to dynamically allocated
As part of the conversion to a `struct peer_connection` it will be desirable to have 2 pointers one for when we open a connection and one for when we receive a connection. Start this actual conversion over to this in `struct peer`. If this sounds confusing take a look at the bgp state machine for connections and how it resolves the processing of this router opening -vs- this router receiving an open. At some point in time the state machine decides that we are keeping one of the two connections. Future commits will allow us to untangle the peer/doppelganger duality with this abstraction. Signed-off-by: Donald Sharp <[email protected]>
1 parent 5d52756 commit 3e5a31b

21 files changed

+340
-314
lines changed

bgpd/bgp_bfd.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static void bfd_session_status_update(struct bfd_session_params *bsp,
5656
peer->last_reset = PEER_DOWN_BFD_DOWN;
5757

5858
/* rfc9384 */
59-
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection.status))
59+
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
6060
bgp_notify_send(peer, BGP_NOTIFY_CEASE,
6161
BGP_NOTIFY_CEASE_BFD_DOWN);
6262

bgpd/bgp_bmp.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ static int bmp_peer_status_changed(struct peer *peer)
703703
if (!bmpbgp)
704704
return 0;
705705

706-
if (peer->connection.status == Deleted) {
706+
if (peer->connection->status == Deleted) {
707707
bbpeer = bmp_bgp_peer_find(peer->qobj_node.nid);
708708
if (bbpeer) {
709709
XFREE(MTYPE_BMP_OPEN, bbpeer->open_rx);
@@ -715,12 +715,12 @@ static int bmp_peer_status_changed(struct peer *peer)
715715
}
716716

717717
/* Check if this peer just went to Established */
718-
if ((peer->connection.ostatus != OpenConfirm) ||
718+
if ((peer->connection->ostatus != OpenConfirm) ||
719719
!(peer_established(peer)))
720720
return 0;
721721

722722
if (peer->doppelganger &&
723-
(peer->doppelganger->connection.status != Deleted)) {
723+
(peer->doppelganger->connection->status != Deleted)) {
724724
bbpeer = bmp_bgp_peer_get(peer);
725725
bbdopp = bmp_bgp_peer_find(peer->doppelganger->qobj_node.nid);
726726
if (bbdopp) {

bgpd/bgp_dump.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,8 @@ int bgp_dump_state(struct peer *peer)
512512
bgp_dump_all.type);
513513
bgp_dump_common(obuf, peer, 1); /* force this in as4speak*/
514514

515-
stream_putw(obuf, peer->connection.ostatus);
516-
stream_putw(obuf, peer->connection.status);
515+
stream_putw(obuf, peer->connection->ostatus);
516+
stream_putw(obuf, peer->connection->status);
517517

518518
/* Set length. */
519519
bgp_dump_set_size(obuf, MSG_PROTOCOL_BGP4MP);

bgpd/bgp_evpn.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -6462,7 +6462,7 @@ void bgp_reimport_evpn_routes_upon_martian_change(
64626462
if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
64636463
continue;
64646464

6465-
if (peer->connection.status != Established)
6465+
if (peer->connection->status != Established)
64666466
continue;
64676467

64686468
if (CHECK_FLAG(peer->af_flags[afi][safi],

0 commit comments

Comments
 (0)