Developing lightweight computation at the DSG edge

Commit 87c3f922 authored by Roger Pueyo Centelles's avatar Roger Pueyo Centelles
Browse files

[qmp-system] Migrate to new UCI network model (II)



Add the qmp_uci_get_raw_item_space_filter_by_name() function to
complete the qmp_uci_get_item_by_unnamed_section_type_and_name()
function, which would otherwise incorrectly return the items for
all the unnamed sections of a given class, instead of just the one
filtered by its "name" property value.

Fixes #489.
Signed-off-by: default avatarRoger Pueyo Centelles <roger.pueyo@guifi.net>
parent 652cf1da
......@@ -33,6 +33,14 @@ qmp_uci_get_raw_item_space() {
return $r
}
qmp_uci_get_raw_item_space_filter_by_name() {
u="$(qmp_uci_get_raw_item_space ${1} dummy name ${4})"
qmp_log "$u"
if [ "$u" == "$2" ]; then
echo "$(qmp_uci_get_raw_item_space ${1} ${3} ${3} ${4})"
fi
}
qmp_uci_get_raw_id_space() {
u="$(qmp_uci_get_raw_item_space ${1} dummy ${3} ${4})"
if [ "$u" == "$2" ]; then
......@@ -40,9 +48,12 @@ qmp_uci_get_raw_id_space() {
fi
}
# Get an item from an unnamed section by its name and type
# qmp_uci_get_item_by_unnamed_section_type_and_name file section_type name value_type
# qmp_uci_get_item_by_unnamed_section_type_and_name network device br-lan type
qmp_uci_get_item_by_unnamed_section_type_and_name() {
config_load $1
local u="$(config_foreach qmp_uci_get_raw_item_space $2 $3 $4 $1)"
local u="$(config_foreach qmp_uci_get_raw_item_space_filter_by_name $2 $3 $4 $1)"
echo $u
}
......
......@@ -306,7 +306,7 @@ qmp_configure_lan() {
local sectionid=$(uci add network device)
uci set network.${sectionid}.type="bridge"
uci set network.${sectionid}.name="br-lan"
uci commit
uci commit network
qmp_uci_set_raw network.lan="interface"
# Fix for #489 after introduction of UCI bridge model (OpenWrt >= 21.02)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment