]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Convert bgp_keepalive_send to use a connection
authorDonald Sharp <sharpd@nvidia.com>
Sun, 16 Feb 2025 18:00:43 +0000 (13:00 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Fri, 28 Feb 2025 15:28:50 +0000 (10:28 -0500)
The peer is going to eventually have a incoming and
outgoing connection.  Let's send the data based
upon the connection not the peer.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd/bgp_fsm.c
bgpd/bgp_keepalives.c
bgpd/bgp_packet.c
bgpd/bgp_packet.h

index b6025ea29fbfeebe6880847ee80463ec61bbae7d..764b6b87162799bbdbb412c16a6f0e9fd83b5a4e 100644 (file)
@@ -1974,14 +1974,12 @@ bgp_reconnect(struct peer_connection *connection)
 static enum bgp_fsm_state_progress
 bgp_fsm_open(struct peer_connection *connection)
 {
-       struct peer *peer = connection->peer;
-
        /* If DelayOpen is active, we may still need to send an open message */
        if ((connection->status == Connect) || (connection->status == Active))
                bgp_open_send(connection);
 
        /* Send keepalive and make keepalive timer */
-       bgp_keepalive_send(peer);
+       bgp_keepalive_send(connection);
 
        return BGP_FSM_SUCCESS;
 }
index 92123c2cd9bfcadcddc5d5fff6b1d19ffa109d04..eda563fe60cc895c382364a9336bb718806bb3f2 100644 (file)
@@ -108,7 +108,7 @@ static void peer_process(struct hash_bucket *hb, void *arg)
                        zlog_debug("%s [FSM] Timer (keepalive timer expire)",
                                   pkat->peer->host);
 
-               bgp_keepalive_send(pkat->peer);
+               bgp_keepalive_send(pkat->peer->connection);
                monotime(&pkat->last);
                memset(&elapsed, 0, sizeof(elapsed));
                diff = ka;
index 54cd1250cbcaf9b63fef99abc19464dd5d294cdf..ec8cc0465b4d1884405734628a5a01284545afe8 100644 (file)
@@ -613,7 +613,7 @@ void bgp_generate_updgrp_packets(struct event *thread)
 /*
  * Creates a BGP Keepalive packet and appends it to the peer's output queue.
  */
-void bgp_keepalive_send(struct peer *peer)
+void bgp_keepalive_send(struct peer_connection *connection)
 {
        struct stream *s;
 
@@ -628,13 +628,13 @@ void bgp_keepalive_send(struct peer *peer)
        /* Dump packet if debug option is set. */
        /* bgp_packet_dump (s); */
 
-       if (bgp_debug_keepalive(peer))
-               zlog_debug("%s sending KEEPALIVE", peer->host);
+       if (bgp_debug_keepalive(connection->peer))
+               zlog_debug("%s sending KEEPALIVE", connection->peer->host);
 
        /* Add packet to the peer. */
-       bgp_packet_add(peer->connection, peer, s);
+       bgp_packet_add(connection, connection->peer, s);
 
-       bgp_writes_on(peer->connection);
+       bgp_writes_on(connection);
 }
 
 struct stream *bgp_open_make(struct peer *peer, uint16_t send_holdtime, as_t local_as,
index ae81aade70b3eb14e6f18befbefcdfa3202660e7..9ecbdc8b872301e902982e67d7306919647f9d7b 100644 (file)
@@ -48,7 +48,7 @@ DECLARE_HOOK(bgp_packet_send,
        } while (0)
 
 /* Packet send and receive function prototypes. */
-extern void bgp_keepalive_send(struct peer *peer);
+extern void bgp_keepalive_send(struct peer_connection *connection);
 extern struct stream *bgp_open_make(struct peer *peer, uint16_t send_holdtime, as_t local_as,
                                    struct in_addr *id);
 extern void bgp_open_send(struct peer_connection *connection);