diff options
author | Lech Perczak <lech.perczak@gmail.com> | 2022-02-21 22:48:10 +0100 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2023-04-29 21:33:04 +0200 |
commit | 356a6f0eee93ffd03e8f398446ceded144c6237f (patch) | |
tree | 86e3608ff21f8fcaa7a8ea554aa4974bc3e0cb2b /package/network/utils/umbim/files/lib/netifd/proto/mbim.sh | |
parent | da84eddedbf0abc8e17b0bfbeac53de1bca1a918 (diff) | |
download | upstream-356a6f0eee93ffd03e8f398446ceded144c6237f.tar.gz upstream-356a6f0eee93ffd03e8f398446ceded144c6237f.tar.bz2 upstream-356a6f0eee93ffd03e8f398446ceded144c6237f.zip |
umbim: detect actual connection IP type
Current implementation needlessly creates both IPv4 and IPv6
sub-interfaces for single-stack IP types. Limit this only to selected IP
type. While at that, ensure that IP type is also passed to umbim during
"connect" phase. In addition, detect the actual established connection
type returned by umbim and set up subinterfaces according to that,
not to requested configuration. While at that, allow empty IP type explicitly,
interpreted as "any" according to MBIM specification.
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
Diffstat (limited to 'package/network/utils/umbim/files/lib/netifd/proto/mbim.sh')
-rwxr-xr-x | package/network/utils/umbim/files/lib/netifd/proto/mbim.sh | 14 |
1 files changed, 10 insertions, 4 deletions
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 c6fa6665ef..c5f3663271 100755 --- a/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh +++ b/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh @@ -149,10 +149,13 @@ _proto_mbim_setup() { tid=$((tid + 1)) pdptype=$(echo "$pdptype" | awk '{print tolower($0)}') - [ "$pdptype" = "ipv4" -o "$pdptype" = "ipv6" -o "$pdptype" = "ipv4v6" ] || pdptype="ipv4v6" + local req_pdptype="" # Pass "default" PDP type to umbim if unconfigured + [ "$pdptype" = "ipv4" -o "$pdptype" = "ipv6" -o "$pdptype" = "ipv4v6" ] && req_pdptype="$pdptype:" + + local connect_state echo "mbim[$$]" "Connect to network" - umbim $DBG -n -t $tid -d $device connect "$pdptype:$apn" "$auth" "$username" "$password" || { + connect_state=$(umbim $DBG -n -t $tid -d $device connect "$req_pdptype$apn" "$auth" "$username" "$password") || { echo "mbim[$$]" "Failed to connect bearer" tid=$((tid + 1)) umbim $DBG -t $tid -d "$device" disconnect @@ -161,6 +164,9 @@ _proto_mbim_setup() { } tid=$((tid + 1)) + echo "$connect_state" + local iptype="$(echo "$connect_state" | grep iptype: | awk '{print $4}')" + echo "mbim[$$]" "Connected" if [ "$dhcp" = 0 ]; then @@ -171,7 +177,7 @@ _proto_mbim_setup() { proto_init_update "$ifname" 1 proto_send_update "$interface" - [ "$pdptype" = "ipv4" -o "$pdptype" = "ipv4v6" ] && { + [ "$iptype" != "ipv6" ] && { json_init json_add_string name "${interface}_4" json_add_string ifname "@$interface" @@ -188,7 +194,7 @@ _proto_mbim_setup() { ubus call network add_dynamic "$(json_dump)" } - [ "$pdptype" = "ipv6" -o "$pdptype" = "ipv4v6" ] && { + [ "$iptype" != "ipv4" ] && { json_init json_add_string name "${interface}_6" json_add_string ifname "@$interface" |