aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2021-05-20 11:34:50 +0900
committerKazuki Yamaguchi <k@rhe.jp>2024-01-31 02:11:51 +0900
commit6424133b342673900148fc0e8cc0d2fe4abbb0b2 (patch)
tree31b821b81ecb879ac9e1c1ee367bb154b39e021e
parentf4e657f9e07adb3861f6172448d6f55551243cfc (diff)
downloadbird-ky/bgp-extended-hold-timer.tar.gz
BGP: add 'soft hold time on' option for debuggingky/bgp-extended-hold-timer
-rw-r--r--proto/bgp/bgp.c13
-rw-r--r--proto/bgp/bgp.h1
-rw-r--r--proto/bgp/config.Y2
3 files changed, 14 insertions, 2 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index 8e8f63e9..fb4bb722 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -1031,9 +1031,18 @@ bgp_hold_timeout(timer *t)
/* If there is something in input queue, we are probably congested
and perhaps just not processed BGP packets in time. */
- if (sk_rx_ready(conn->sk) > 0)
+ if (sk_rx_ready(conn->sk) > 0) {
bgp_start_timer(conn->hold_timer, 10, 0);
- else if ((conn->state == BS_ESTABLISHED) && p->llgr_ready)
+ return;
+ }
+
+ if (p->cf->soft_hold_time) {
+ log(L_WARN "%s: Hold timer soft-expired", p->p.name);
+ bgp_start_timer(conn->hold_timer, 10, 0);
+ return;
+ }
+
+ if ((conn->state == BS_ESTABLISHED) && p->llgr_ready)
{
BGP_TRACE(D_EVENTS, "Hold timer expired");
bgp_handle_graceful_restart(p);
diff --git a/proto/bgp/bgp.h b/proto/bgp/bgp.h
index c29b8f6d..53c5deb8 100644
--- a/proto/bgp/bgp.h
+++ b/proto/bgp/bgp.h
@@ -127,6 +127,7 @@ struct bgp_config {
unsigned hold_time;
unsigned min_hold_time; /* Minimum accepted hold time */
unsigned initial_hold_time;
+ int soft_hold_time;
unsigned keepalive_time;
unsigned min_keepalive_time; /* Minimum accepted keepalive time */
unsigned error_amnesia_time; /* Errors are forgotten after */
diff --git a/proto/bgp/config.Y b/proto/bgp/config.Y
index 1173ff06..649109e5 100644
--- a/proto/bgp/config.Y
+++ b/proto/bgp/config.Y
@@ -54,6 +54,7 @@ bgp_proto_start: proto_start BGP {
BGP_CFG->multihop = -1; /* undefined */
BGP_CFG->hold_time = 240;
BGP_CFG->initial_hold_time = 240;
+ BGP_CFG->soft_hold_time = 0;
BGP_CFG->compare_path_lengths = 1;
BGP_CFG->igp_metric = 1;
BGP_CFG->connect_delay_time = 5;
@@ -159,6 +160,7 @@ bgp_proto:
| bgp_proto HOLD TIME expr ';' { BGP_CFG->hold_time = $4; if (($4 && $4<3) || ($4>65535)) cf_error("Hold time must be in range 3-65535 or zero"); }
| bgp_proto MIN HOLD TIME expr ';' { BGP_CFG->min_hold_time = $5; }
| bgp_proto STARTUP HOLD TIME expr ';' { BGP_CFG->initial_hold_time = $5; }
+ | bgp_proto SOFT HOLD TIME bool ';' { BGP_CFG->soft_hold_time = $5; }
| bgp_proto DIRECT ';' { BGP_CFG->multihop = 0; }
| bgp_proto MULTIHOP ';' { BGP_CFG->multihop = 64; }
| bgp_proto MULTIHOP expr ';' { BGP_CFG->multihop = $3; if (($3<1) || ($3>255)) cf_error("Multihop must be in range 1-255"); }