summaryrefslogtreecommitdiff
path: root/net/keepalived
diff options
context:
space:
mode:
authorFrancisco Jose Alvarez <francisco.alvarez@galgus.net>2022-04-20 12:51:13 +0200
committerFrancisco Jose Alvarez <francisco.alvarez@galgus.net>2022-04-28 18:11:30 +0200
commitf514bff2de60d2286ec2dd0943e30e5b1a1c029a (patch)
tree22e09d87a2d95957b8f99e1f967412ac07a047b1 /net/keepalived
parent2c2a8990bb20949c24976caf6aa4ea5c23b0304b (diff)
keepalived: add uci support for track_bfd configuration
Allow the configuration of track_bfd for vrrp instance throught uci Signed-off-by: Francisco Jose Alvarez <francisco.alvarez@galgus.net>
Diffstat (limited to 'net/keepalived')
-rw-r--r--net/keepalived/files/keepalived.init42
1 files changed, 42 insertions, 0 deletions
diff --git a/net/keepalived/files/keepalived.init b/net/keepalived/files/keepalived.init
index 03c2af689..4f73cb6df 100644
--- a/net/keepalived/files/keepalived.init
+++ b/net/keepalived/files/keepalived.init
@@ -218,6 +218,22 @@ print_track_elem_indent() {
printf '\n' >> "$KEEPALIVED_CONF"
}
+print_track_bfd_indent() {
+ local section="$1"
+ local curr_track_elem="$2"
+ local indent="$3"
+ local name
+
+ config_get name "$section" name
+ [ "$name" != "$curr_track_elem" ] && return 0
+
+ config_get weight "$section" weight
+
+ printf '%b%s' "$indent" "$name" >> "$KEEPALIVED_CONF"
+ [ -n "$weight" ] && printf ' weight %s' "$weight" >> "$KEEPALIVED_CONF"
+ printf '\n' >> "$KEEPALIVED_CONF"
+}
+
static_routes() {
local route
config_get route "$1" route
@@ -350,6 +366,18 @@ vrrp_instance() {
printf '%b}\n' "${INDENT_1}" >> "$KEEPALIVED_CONF"
done
+ # Handle track_bfd lists
+ for opt in track_bfd; do
+ config_get "$opt" "$1" "$opt"
+ eval optval=\$$opt
+ [ -z "$optval" ] && continue
+ printf '%b%s {\n' "${INDENT_1}" "$opt" >> "$KEEPALIVED_CONF"
+ for t in $optval; do
+ config_foreach print_track_bfd_indent bfd_instance "$t" "$INDENT_2"
+ done
+ printf '%b}\n' "${INDENT_1}" >> "$KEEPALIVED_CONF"
+ done
+
# Handle simple lists of strings (with no spaces in between)
for opt in unicast_peer; do
config_get "$opt" "$1" "$opt"
@@ -373,6 +401,19 @@ vrrp_script() {
config_section_close
}
+
+bfd_instance() {
+ local name
+
+ config_get name "$1" name
+ [ -z "$name" ] && return 0
+ config_section_open "bfd_instance" "$name"
+
+ print_elems_indent "$1" "$INDENT_1" neighbor_ip source_ip min_rx min_tx idle_tx hoplimit max_hops
+
+ config_section_close
+}
+
url() {
local url="$2"
@@ -517,6 +558,7 @@ process_config() {
config_section_close
config_foreach_wrapper vrrp_script
+ config_foreach_wrapper bfd_instance
config_foreach_wrapper vrrp_sync_group
config_foreach_wrapper vrrp_instance
config_foreach_wrapper virtual_server