summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2021-09-03 13:56:35 +0200
committerDonald Sharp <sharpd@nvidia.com>2021-09-03 13:56:35 +0200
commitc5fe9095fe3ed4ebff4bb54618086deeae60cbd9 (patch)
tree00d0dd0403cf7ed02dd41b5ec3c42eea2c11db1d /bgpd
parentMerge pull request #9538 from donaldsharp/bgp_view_not_working (diff)
downloadfrr-c5fe9095fe3ed4ebff4bb54618086deeae60cbd9.tar.xz
frr-c5fe9095fe3ed4ebff4bb54618086deeae60cbd9.zip
bgpd: Add `PEER_DOWN_SOCKET_ERROR` to the list of peer failure modes
BGP can experience a bunch of errors associated with sockets being manipulated which would prevent the peer from coming up. Let's add some additional debug information here so that our operators can do a bit more for themselves. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_fsm.c3
-rw-r--r--bgpd/bgp_network.c3
-rw-r--r--bgpd/bgpd.h1
3 files changed, 6 insertions, 1 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index 0f2926d06..deee52cde 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -640,7 +640,8 @@ const char *const peer_down_str[] = {"",
"No AFI/SAFI activated for peer",
"AS Set config change",
"Waiting for peer OPEN",
- "Reached received prefix count"};
+ "Reached received prefix count",
+ "Socket Error"};
static int bgp_graceful_restart_timer_expire(struct thread *thread)
{
diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c
index 3005eba27..6bd7acfed 100644
--- a/bgpd/bgp_network.c
+++ b/bgpd/bgp_network.c
@@ -716,6 +716,7 @@ int bgp_connect(struct peer *peer)
bgp_get_bound_name(peer));
}
if (peer->fd < 0) {
+ peer->last_reset = PEER_DOWN_SOCKET_ERROR;
if (bgp_debug_neighbor_events(peer))
zlog_debug("%s: Failure to create socket for connection to %s, error received: %s(%d)",
__func__, peer->host, safe_strerror(errno),
@@ -732,6 +733,7 @@ int bgp_connect(struct peer *peer)
bgp_socket_set_buffer_size(peer->fd);
if (bgp_set_socket_ttl(peer, peer->fd) < 0) {
+ peer->last_reset = PEER_DOWN_SOCKET_ERROR;
if (bgp_debug_neighbor_events(peer))
zlog_debug("%s: Failure to set socket ttl for connection to %s, error received: %s(%d)",
__func__, peer->host, safe_strerror(errno),
@@ -764,6 +766,7 @@ int bgp_connect(struct peer *peer)
/* Update source bind. */
if (bgp_update_source(peer) < 0) {
+ peer->last_reset = PEER_DOWN_SOCKET_ERROR;
return connect_error;
}
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index eb1a18edc..00264aea8 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -1593,6 +1593,7 @@ struct peer {
#define PEER_DOWN_AS_SETS_REJECT 31U /* Reject routes with AS_SET */
#define PEER_DOWN_WAITING_OPEN 32U /* Waiting for open to succeed */
#define PEER_DOWN_PFX_COUNT 33U /* Reached received prefix count */
+#define PEER_DOWN_SOCKET_ERROR 34U /* Some socket error happened */
/*
* Remember to update peer_down_str in bgp_fsm.c when you add
* a new value to the last_reset reason