mirror of
https://git.proxmox.com/git/mirror_frr
synced 2026-01-05 08:22:22 +00:00
bgpd: bgp_connect should return an enum connect_result
This function when it is run by bgp_start is expected to return a `enum connect_result`. But instead the function returns a variety of values that are not really being checked for. Consolidate to a correct choice. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
bca99119d9
commit
2a94de8af2
@ -1826,7 +1826,7 @@ static void bgp_connect_in_progress_update_connection(struct peer *peer)
|
||||
static enum bgp_fsm_state_progress bgp_start(struct peer_connection *connection)
|
||||
{
|
||||
struct peer *peer = connection->peer;
|
||||
int status;
|
||||
enum connect_result status;
|
||||
|
||||
bgp_peer_conf_if_to_su_update(connection);
|
||||
|
||||
|
||||
@ -762,7 +762,7 @@ static int bgp_update_source(struct peer_connection *connection)
|
||||
}
|
||||
|
||||
/* BGP try to connect to the peer. */
|
||||
int bgp_connect(struct peer_connection *connection)
|
||||
enum connect_result bgp_connect(struct peer_connection *connection)
|
||||
{
|
||||
struct peer *peer = connection->peer;
|
||||
|
||||
@ -773,7 +773,7 @@ int bgp_connect(struct peer_connection *connection)
|
||||
if (peer->conf_if && BGP_CONNECTION_SU_UNSPEC(connection)) {
|
||||
if (bgp_debug_neighbor_events(peer))
|
||||
zlog_debug("Peer address not learnt: Returning from connect");
|
||||
return 0;
|
||||
return connect_error;
|
||||
}
|
||||
frr_with_privs(&bgpd_privs) {
|
||||
/* Make socket for the peer. */
|
||||
@ -787,7 +787,7 @@ int bgp_connect(struct peer_connection *connection)
|
||||
zlog_debug("%s: Failure to create socket for connection to %s, error received: %s(%d)",
|
||||
__func__, peer->host, safe_strerror(errno),
|
||||
errno);
|
||||
return -1;
|
||||
return connect_error;
|
||||
}
|
||||
|
||||
set_nonblocking(connection->fd);
|
||||
@ -808,7 +808,7 @@ int bgp_connect(struct peer_connection *connection)
|
||||
__func__, peer->host, safe_strerror(errno),
|
||||
errno);
|
||||
|
||||
return -1;
|
||||
return connect_error;
|
||||
}
|
||||
|
||||
sockopt_reuseaddr(connection->fd);
|
||||
@ -844,7 +844,7 @@ int bgp_connect(struct peer_connection *connection)
|
||||
/* If the peer is passive mode, force to move to Active mode. */
|
||||
if (CHECK_FLAG(peer->flags, PEER_FLAG_PASSIVE)) {
|
||||
BGP_EVENT_ADD(connection, TCP_connection_open_failed);
|
||||
return BGP_FSM_SUCCESS;
|
||||
return connect_error;
|
||||
}
|
||||
|
||||
if (peer->conf_if || peer->ifname)
|
||||
|
||||
@ -21,7 +21,7 @@ extern int bgp_socket(struct bgp *bgp, unsigned short port,
|
||||
const char *address);
|
||||
extern void bgp_close_vrf_socket(struct bgp *bgp);
|
||||
extern void bgp_close(void);
|
||||
extern int bgp_connect(struct peer_connection *connection);
|
||||
extern enum connect_result bgp_connect(struct peer_connection *connection);
|
||||
extern int bgp_getsockname(struct peer *peer);
|
||||
extern void bgp_updatesockname(struct peer *peer);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user