summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2024-05-28 15:31:52 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2024-05-28 15:31:52 +0200
commite29f134ad9346343277b7cb4581d2a704592dc79 (patch)
treec07f2b74b64c5b8e564d0b661f740d5415c5ca6c
parent765debf5236375595d52aaa188183df8b5edd4f4 (diff)
BFD: Fix build when BFD is disabled
Move bfd_opts grammar inside BFD parser code to avoid dependences between nest and BFD grammars, which breaks when BFD build is disabled. Add dummy bfd_opts grammar rule, so protocols can use this nonterminal even with BFD disabled. Thanks to Yuri Honegger for the bugreport.
-rw-r--r--nest/config.Y48
-rw-r--r--proto/bfd/config.Y46
2 files changed, 48 insertions, 46 deletions
diff --git a/nest/config.Y b/nest/config.Y
index 62b28072..6b89f5d8 100644
--- a/nest/config.Y
+++ b/nest/config.Y
@@ -124,7 +124,6 @@ CF_KEYWORDS(BGP, PASSWORDS, DESCRIPTION)
CF_KEYWORDS(RELOAD, IN, OUT, MRTDUMP, MESSAGES, RESTRICT, MEMORY, IGP_METRIC, CLASS, DSCP)
CF_KEYWORDS(TIMEFORMAT, ISO, SHORT, LONG, ROUTE, PROTOCOL, BASE, LOG, S, MS, US)
CF_KEYWORDS(GRACEFUL, RESTART, WAIT, MAX, AS)
-CF_KEYWORDS(MIN, IDLE, RX, TX, INTERVAL, MULTIPLIER, PASSIVE)
CF_KEYWORDS(CHECK, LINK)
CF_KEYWORDS(SORTED, TRIE, MIN, MAX, SETTLE, TIME, GC, THRESHOLD, PERIOD)
CF_KEYWORDS(MPLS_LABEL, MPLS_POLICY, MPLS_CLASS)
@@ -602,51 +601,8 @@ password_item_end:
};
-/* BFD options */
-
-bfd_item:
- INTERVAL expr_us { this_bfd_opts->min_rx_int = this_bfd_opts->min_tx_int = $2; }
- | MIN RX INTERVAL expr_us { this_bfd_opts->min_rx_int = $4; }
- | MIN TX INTERVAL expr_us { this_bfd_opts->min_tx_int = $4; }
- | IDLE TX INTERVAL expr_us { this_bfd_opts->idle_tx_int = $4; }
- | MULTIPLIER expr { this_bfd_opts->multiplier = $2; }
- | PASSIVE bool { this_bfd_opts->passive = $2; this_bfd_opts->passive_set = 1; }
- | GRACEFUL { this_bfd_opts->mode = BGP_BFD_GRACEFUL; }
- | AUTHENTICATION bfd_auth_type { this_bfd_opts->auth_type = $2; }
- | password_list {}
- ;
-
-bfd_items:
- /* empty */
- | bfd_items bfd_item ';'
- ;
-
-bfd_opts_start:
-{ reset_passwords(); } ;
-
-bfd_opts_end:
-{
- this_bfd_opts->passwords = get_passwords();
-
- if (!this_bfd_opts->auth_type != !this_bfd_opts->passwords)
- cf_warn("Authentication and password options should be used together");
-
- if (this_bfd_opts->passwords)
- {
- struct password_item *pass;
- WALK_LIST(pass, *this_bfd_opts->passwords)
- {
- if (pass->alg)
- cf_error("Password algorithm option not available in BFD protocol");
-
- pass->alg = bfd_auth_type_to_hash_alg[this_bfd_opts->auth_type];
- }
- }
-};
-
-bfd_opts:
- bfd_opts_start '{' bfd_items '}' bfd_opts_end
- ;
+/* BFD options - just dummy rule, rest in proto/bfd/config.Y */
+bfd_opts: '{' INVALID_TOKEN '}';
/* Core commands */
diff --git a/proto/bfd/config.Y b/proto/bfd/config.Y
index 1a7474b0..39e7577f 100644
--- a/proto/bfd/config.Y
+++ b/proto/bfd/config.Y
@@ -183,6 +183,52 @@ bfd_neighbor: ipa bfd_neigh_iface bfd_neigh_local bfd_neigh_multihop
};
+/* BFD options */
+
+bfd_item:
+ INTERVAL expr_us { this_bfd_opts->min_rx_int = this_bfd_opts->min_tx_int = $2; }
+ | MIN RX INTERVAL expr_us { this_bfd_opts->min_rx_int = $4; }
+ | MIN TX INTERVAL expr_us { this_bfd_opts->min_tx_int = $4; }
+ | IDLE TX INTERVAL expr_us { this_bfd_opts->idle_tx_int = $4; }
+ | MULTIPLIER expr { this_bfd_opts->multiplier = $2; }
+ | PASSIVE bool { this_bfd_opts->passive = $2; this_bfd_opts->passive_set = 1; }
+ | GRACEFUL { this_bfd_opts->mode = BGP_BFD_GRACEFUL; }
+ | AUTHENTICATION bfd_auth_type { this_bfd_opts->auth_type = $2; }
+ | password_list {}
+ ;
+
+bfd_items:
+ /* empty */
+ | bfd_items bfd_item ';'
+ ;
+
+bfd_opts_start:
+{ reset_passwords(); } ;
+
+bfd_opts_end:
+{
+ this_bfd_opts->passwords = get_passwords();
+
+ if (!this_bfd_opts->auth_type != !this_bfd_opts->passwords)
+ cf_warn("Authentication and password options should be used together");
+
+ if (this_bfd_opts->passwords)
+ {
+ struct password_item *pass;
+ WALK_LIST(pass, *this_bfd_opts->passwords)
+ {
+ if (pass->alg)
+ cf_error("Password algorithm option not available in BFD protocol");
+
+ pass->alg = bfd_auth_type_to_hash_alg[this_bfd_opts->auth_type];
+ }
+ }
+};
+
+bfd_opts:
+ '{' bfd_opts_start bfd_items '}' bfd_opts_end;
+
+
CF_CLI_HELP(SHOW BFD, ..., [[Show information about BFD protocol]]);
CF_CLI_HELP(SHOW BFD SESSIONS, ..., [[Show information about BFD sessions]]);