summaryrefslogtreecommitdiff
path: root/proto/bgp/bgp.c
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2023-01-21 23:45:13 +0100
committerMaria Matejka <mq@ucw.cz>2023-01-21 23:45:13 +0100
commit985c060342867b5f386ef2921d1dce2e0f2406e5 (patch)
treebfb9c7170dae06f91ef1fdd206c500edf04f64fd /proto/bgp/bgp.c
parent4500749ce63b7b225d8016fc5e58253c84b23b52 (diff)
parent3859e4efc1597368df647323c5a3cc1771cb64ca (diff)
Merge commit '3859e4efc1597368df647323c5a3cc1771cb64ca' into thread-next
Diffstat (limited to 'proto/bgp/bgp.c')
-rw-r--r--proto/bgp/bgp.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index 2f8da1af..e8e65ad7 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -2075,6 +2075,21 @@ bgp_postconfig(struct proto_config *CF)
if (internal && cf->enforce_first_as)
cf_error("Enforce first AS check is requires EBGP sessions");
+ if (cf->keepalive_time > cf->hold_time)
+ cf_error("Keepalive time must be at most hold time");
+
+ if (cf->keepalive_time > (cf->hold_time / 2))
+ log(L_WARN "Keepalive time should be at most 1/2 of hold time");
+
+ if (cf->min_hold_time > cf->hold_time)
+ cf_error("Min hold time (%u) exceeds hold time (%u)",
+ cf->min_hold_time, cf->hold_time);
+
+ uint keepalive_time = cf->keepalive_time ?: cf->hold_time / 3;
+ if (cf->min_keepalive_time > keepalive_time)
+ cf_error("Min keepalive time (%u) exceeds keepalive time (%u)",
+ cf->min_keepalive_time, keepalive_time);
+
struct bgp_channel_config *cc;
BGP_CF_WALK_CHANNELS(cf, cc)