summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2024-12-17 21:38:01 +0100
committerDonald Sharp <sharpd@nvidia.com>2025-01-10 16:06:16 +0100
commit0e416ff157341b69276e122a404837a22c890105 (patch)
treeafc815c789c565b5ca603720a24599322107c419
parentMerge pull request #17813 from enkechen-panw/aigp-fix6 (diff)
downloadfrr-0e416ff157341b69276e122a404837a22c890105.tar.xz
frr-0e416ff157341b69276e122a404837a22c890105.zip
bgpd: bgp_getsockanme is connection oriented
Let's make it so. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
-rw-r--r--bgpd/bgp_fsm.c4
-rw-r--r--bgpd/bgp_network.c6
-rw-r--r--bgpd/bgp_network.h2
3 files changed, 7 insertions, 5 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index 3d02214ca..3389f9afd 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -1819,8 +1819,8 @@ static void bgp_connect_in_progress_update_connection(struct peer_connection *co
{
struct peer *peer = connection->peer;
- bgp_updatesockname(peer, connection);
- if (!peer->su_remote && !BGP_CONNECTION_SU_UNSPEC(peer->connection)) {
+ bgp_updatesockname(connection);
+ if (!peer->su_remote && !BGP_CONNECTION_SU_UNSPEC(connection)) {
/* if connect initiated, then dest port and dest addresses are well known */
peer->su_remote = sockunion_dup(&connection->su);
if (sockunion_family(peer->su_remote) == AF_INET)
diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c
index f1bea1c18..35ceb9d99 100644
--- a/bgpd/bgp_network.c
+++ b/bgpd/bgp_network.c
@@ -861,8 +861,10 @@ enum connect_result bgp_connect(struct peer_connection *connection)
htons(peer->port), ifindex);
}
-void bgp_updatesockname(struct peer *peer, struct peer_connection *connection)
+void bgp_updatesockname(struct peer_connection *connection)
{
+ struct peer *peer = connection->peer;
+
if (peer->su_local) {
sockunion_free(peer->su_local);
peer->su_local = NULL;
@@ -882,7 +884,7 @@ int bgp_getsockname(struct peer_connection *connection)
{
struct peer *peer = connection->peer;
- bgp_updatesockname(peer, peer->connection);
+ bgp_updatesockname(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 ed1a72ec8..bd8c285f3 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 enum connect_result bgp_connect(struct peer_connection *connection);
extern int bgp_getsockname(struct peer_connection *connection);
-extern void bgp_updatesockname(struct peer *peer, struct peer_connection *connection);
+extern void bgp_updatesockname(struct peer_connection *connection);
extern int bgp_md5_set_prefix(struct bgp *bgp, struct prefix *p,
const char *password);