summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Pueyo Centelles <roger.pueyo@guifi.net>2023-02-26 17:02:08 +0100
committerJosef Schlehofer <pepe.schlehofer@gmail.com>2023-03-06 13:00:14 +0100
commitd32f93e0499164ac171228bbb6e8a5b17b8785fe (patch)
treee47205d01c13e8ecf7ffc5117f68fdb9d4c68948
parent6697ca291f97438e937897d73acc46a29d7dc9f4 (diff)
bird1: rename get_bool() to get_a_bool() in bird{4,6}-lib.sh
This patch renames the get_bool() function, implemented in the bird4-lib.sh and bird6-lib.sh files (respectively, for the IPv4 and the IPv6 versions of the package), as well as all the calls to it. This way, we avoid a function name collision with the one provided by file /lib/functions.sh, which is slightly different and caused an out-of-memory error when parsing the bird4/bird6 UCI config files. Fixes #920. Signed-off-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
-rw-r--r--bird1-openwrt/Makefile2
-rw-r--r--bird1-openwrt/bird1-ipv4-openwrt/src/init.d/bird4-lib.sh19
-rw-r--r--bird1-openwrt/bird1-ipv6-openwrt/src/init.d/bird6-lib.sh15
3 files changed, 21 insertions, 15 deletions
diff --git a/bird1-openwrt/Makefile b/bird1-openwrt/Makefile
index aca7b75..c04919f 100644
--- a/bird1-openwrt/Makefile
+++ b/bird1-openwrt/Makefile
@@ -16,7 +16,7 @@ PKG_NAME := $(BIRD1_PKG)-openwrt
PKG_IPV4_NAME := $(BIRD1_IPV4_PKG)-openwrt
PKG_IPV6_NAME := $(BIRD1_IPV6_PKG)-openwrt
PKG_VERSION := 0.3
-PKG_RELEASE := 3
+PKG_RELEASE := 4
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
PKG_LICENSE := GPL-3.0-or-later
diff --git a/bird1-openwrt/bird1-ipv4-openwrt/src/init.d/bird4-lib.sh b/bird1-openwrt/bird1-ipv4-openwrt/src/init.d/bird4-lib.sh
index 7248a97..f2a5719 100644
--- a/bird1-openwrt/bird1-ipv4-openwrt/src/init.d/bird4-lib.sh
+++ b/bird1-openwrt/bird1-ipv4-openwrt/src/init.d/bird4-lib.sh
@@ -56,12 +56,15 @@ get() {
}
-# Function: get_bool $1 $2
+# Function: get_a_bool $1 $2
# $1 boolean. $2 string
# This function uses the external UCI function "config_get_bool $result $section $option" to obtain a boolean value from UCI config file.
# To use this function, use the same name of the UCI option for the variable $1.
# Example: UCI (option use_ipv6 '1'); local use_ipv6; get use_ipv6 $section
-get_bool() {
+# Note: this function was originally called get_bool(), but it collided with
+# the get_bool() function provided by /lib/functions.sh. Read more at
+# https://github.com/openwrt/routing/issues/920.
+get_a_bool() {
config_get_bool $1 $2 $1
}
@@ -201,7 +204,7 @@ prepare_kernel() {
local disabled; local table; local kernel_table; local import; local export
local scan_time; local persist; local learn
- get_bool disabled ${section}
+ get_a_bool disabled ${section}
get table ${section}
get import ${section}
get export ${section}
@@ -328,7 +331,7 @@ prepare_bgp_template() {
local import_limit; local import_limit_action; local export_limit; local export_limit_action
local receive_limit; local receive_limit_action; local igp_table
- get_bool disabled ${section}
+ get_a_bool disabled ${section}
get table ${section}
get import ${section}
get export ${section}
@@ -338,8 +341,8 @@ prepare_bgp_template() {
get neighbor_address ${section}
get neighbor_as ${section}
- get_bool next_hop_self ${section}
- get_bool next_hop_keep ${section}
+ get_a_bool next_hop_self ${section}
+ get_a_bool next_hop_keep ${section}
get rr_client ${section}
get rr_cluster_id ${section}
@@ -417,8 +420,8 @@ prepare_bgp() {
get receive_limit ${section}
get receive_limit_action ${section}
- get_bool next_hop_self ${section}
- get_bool next_hop_keep ${section}
+ get_a_bool next_hop_self ${section}
+ get_a_bool next_hop_keep ${section}
get rr_client ${section}
get rr_cluster_id ${section}
diff --git a/bird1-openwrt/bird1-ipv6-openwrt/src/init.d/bird6-lib.sh b/bird1-openwrt/bird1-ipv6-openwrt/src/init.d/bird6-lib.sh
index 7d29810..7a4b00f 100644
--- a/bird1-openwrt/bird1-ipv6-openwrt/src/init.d/bird6-lib.sh
+++ b/bird1-openwrt/bird1-ipv6-openwrt/src/init.d/bird6-lib.sh
@@ -57,12 +57,15 @@ get() {
}
-# Function: get_bool $1 $2
+# Function: get_a_bool $1 $2
# $1 boolean. $2 string
# This function uses the external UCI function "config_get_bool $result $section $option" to obtain a boolean value from UCI config file.
# To use this function, use the same name of the UCI option for the variable $1.
# Example: UCI (option use_ipv6 '1'); local use_ipv6; get use_ipv6 $section
-get_bool() {
+# Note: this function was originally called get_bool(), but it collided with
+# the get_bool() function provided by /lib/functions.sh. Read more at
+# https://github.com/openwrt/routing/issues/920.
+get_a_bool() {
config_get_bool $1 $2 $1
}
@@ -195,7 +198,7 @@ prepare_kernel() {
local disabled; local table; local kernel_table; local import; local export
local scan_time; local persist; local learn
- get_bool disabled ${section}
+ get_a_bool disabled ${section}
get table ${section}
get import ${section}
get export ${section}
@@ -322,9 +325,9 @@ prepare_bgp_template() {
local import_limit; local import_limit_action; local export_limit; local export_limit_action
local receive_limit; local receive_limit_action; local igp_table
- get_bool disabled ${section}
- get_bool next_hop_self ${section}
- get_bool next_hop_keep ${section}
+ get_a_bool disabled ${section}
+ get_a_bool next_hop_self ${section}
+ get_a_bool next_hop_keep ${section}
get table ${section}
get import ${section}
get export ${section}