[openwrt/openwrt] umbim: add "_proto_mbim_get_field" helper
LEDE Commits
lede-commits at lists.infradead.org
Sat Apr 29 12:39:16 PDT 2023
hauke pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/f01fff63fbe61186128e000a3bccb7ed159fcb0c
commit f01fff63fbe61186128e000a3bccb7ed159fcb0c
Author: Lech Perczak <lech.perczak at gmail.com>
AuthorDate: Sat Nov 6 13:21:32 2021 +0100
umbim: add "_proto_mbim_get_field" helper
Add a new helper to extract IP configuration from umbim output. This is
required to extract fields which can possibly have multiple values,
namely IP addresses and DNS servers, and get rid of primitive parser
using 'eval' builtin without support for this.
Signed-off-by: Lech Perczak <lech.perczak at gmail.com>
---
package/network/utils/umbim/files/lib/netifd/proto/mbim.sh | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh b/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh
index 9ab7724232..8f1ae9ac25 100755
--- a/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh
+++ b/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh
@@ -26,6 +26,18 @@ proto_mbim_init_config() {
proto_config_add_defaults
}
+_proto_mbim_get_field() {
+ local field="$1"
+ shift
+ local mbimconfig="$@"
+ echo "$mbimconfig" | while read -r line; do
+ variable=${line%%:*}
+ [ "$variable" = "$field" ] || continue;
+ value=${line##* }
+ echo -n "$value "
+ done
+}
+
_proto_mbim_setup() {
local interface="$1"
local tid=2
More information about the lede-commits
mailing list