From 30d5d1d86234255c907f9bc7d01fc5c83a93b6df Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 6 Nov 2024 11:55:43 -0500 Subject: [PATCH] bgpd: Modify bgp_udpatesockname to pass in a connection Signed-off-by: Donald Sharp --- bgpd/bgp_fsm.c | 2 +- bgpd/bgp_network.c | 8 ++++---- bgpd/bgp_network.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index 261c64ab573e..794587656cfa 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -1810,7 +1810,7 @@ bgp_connect_fail(struct peer_connection *connection) */ static void bgp_connect_in_progress_update_connection(struct peer *peer) { - bgp_updatesockname(peer); + bgp_updatesockname(peer, peer->connection); if (!peer->su_remote && !BGP_CONNECTION_SU_UNSPEC(peer->connection)) { /* if connect initiated, then dest port and dest addresses are well known */ peer->su_remote = sockunion_dup(&peer->connection->su); diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index de57d91806e1..1d6954620927 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -861,7 +861,7 @@ int bgp_connect(struct peer_connection *connection) htons(peer->port), ifindex); } -void bgp_updatesockname(struct peer *peer) +void bgp_updatesockname(struct peer *peer, struct peer_connection *connection) { if (peer->su_local) { sockunion_free(peer->su_local); @@ -873,14 +873,14 @@ void bgp_updatesockname(struct peer *peer) peer->su_remote = NULL; } - peer->su_local = sockunion_getsockname(peer->connection->fd); - peer->su_remote = sockunion_getpeername(peer->connection->fd); + peer->su_local = sockunion_getsockname(connection->fd); + peer->su_remote = sockunion_getpeername(connection->fd); } /* After TCP connection is established. Get local address and port. */ int bgp_getsockname(struct peer *peer) { - bgp_updatesockname(peer); + bgp_updatesockname(peer, peer->connection); if (!bgp_zebra_nexthop_set(peer->su_local, peer->su_remote, &peer->nexthop, peer)) { diff --git a/bgpd/bgp_network.h b/bgpd/bgp_network.h index ceb6b6f002e3..f145efb4f933 100644 --- a/bgpd/bgp_network.h +++ b/bgpd/bgp_network.h @@ -23,7 +23,7 @@ extern void bgp_close_vrf_socket(struct bgp *bgp); extern void bgp_close(void); extern int bgp_connect(struct peer_connection *connection); extern int bgp_getsockname(struct peer *peer); -extern void bgp_updatesockname(struct peer *peer); +extern void bgp_updatesockname(struct peer *peer, struct peer_connection *connection); extern int bgp_md5_set_prefix(struct bgp *bgp, struct prefix *p, const char *password);