aboutsummaryrefslogtreecommitdiffstats
path: root/proto
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2020-11-12 04:02:38 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2020-11-12 04:02:38 +0100
commit3b56bf8849283977f2f4fa7b8f3dc62fdd8d7587 (patch)
tree871526fcf88300711a203be912ad18c31701b8ec /proto
parent99ad208dd73d357156672a53f48b77dcf6515c30 (diff)
downloadbird-3b56bf8849283977f2f4fa7b8f3dc62fdd8d7587.tar.gz
BFD: Better handling of BFD options in BGP configs
Merge multiple BFD option blocks in BGP configs instead of using the last one. That is necessary for proper handling of templates when BFD options are used both in a BGP template and in a BGP protocol derived from that template.
Diffstat (limited to 'proto')
-rw-r--r--proto/bgp/bgp.h2
-rw-r--r--proto/bgp/config.Y6
2 files changed, 4 insertions, 4 deletions
diff --git a/proto/bgp/bgp.h b/proto/bgp/bgp.h
index 5f365fcd..ff52a1a1 100644
--- a/proto/bgp/bgp.h
+++ b/proto/bgp/bgp.h
@@ -130,7 +130,7 @@ struct bgp_config {
const char *dynamic_name; /* Name pattern for dynamic BGP */
int dynamic_name_digits; /* Minimum number of digits for dynamic names */
int check_link; /* Use iface link state for liveness detection */
- const struct bfd_options *bfd; /* Use BFD for liveness detection */
+ struct bfd_options *bfd; /* Use BFD for liveness detection */
};
struct bgp_channel_config {
diff --git a/proto/bgp/config.Y b/proto/bgp/config.Y
index dc295645..cc83bfc7 100644
--- a/proto/bgp/config.Y
+++ b/proto/bgp/config.Y
@@ -190,9 +190,9 @@ bgp_proto:
| bgp_proto LONG LIVED STALE TIME expr ';' { BGP_CFG->llgr_time = $6; }
| bgp_proto TTL SECURITY bool ';' { BGP_CFG->ttl_security = $4; }
| bgp_proto CHECK LINK bool ';' { BGP_CFG->check_link = $4; }
- | bgp_proto BFD bool ';' { cf_check_bfd($3); BGP_CFG->bfd = $3 ? bfd_new_options() : NULL; }
- | bgp_proto BFD GRACEFUL ';' { cf_check_bfd(1); struct bfd_options *opts = bfd_new_options(); opts->mode = BGP_BFD_GRACEFUL; BGP_CFG->bfd = opts; }
- | bgp_proto BFD bfd_opts ';' { BGP_CFG->bfd = $3; cf_check_bfd(1); }
+ | bgp_proto BFD bool ';' { if ($3) init_bfd_opts(&BGP_CFG->bfd); else BGP_CFG->bfd = NULL; }
+ | bgp_proto BFD GRACEFUL ';' { init_bfd_opts(&BGP_CFG->bfd); BGP_CFG->bfd->mode = BGP_BFD_GRACEFUL; }
+ | bgp_proto BFD { open_bfd_opts(&BGP_CFG->bfd); } bfd_opts { close_bfd_opts(); } ';'
| bgp_proto ENFORCE FIRST AS bool ';' { BGP_CFG->enforce_first_as = $5; }
;