aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLech Perczak <lech.perczak@gmail.com>2021-07-19 21:16:08 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2023-04-29 21:33:04 +0200
commit03692dee736b98ba419d4e21e82819f93b637256 (patch)
tree75f8467692b2511a8a7b0c5014e930eddf3050dd
parentc1e0d077444b7570d64772338d81db336c94ea94 (diff)
downloadupstream-03692dee736b98ba419d4e21e82819f93b637256.tar.gz
upstream-03692dee736b98ba419d4e21e82819f93b637256.tar.bz2
upstream-03692dee736b98ba419d4e21e82819f93b637256.zip
umbim: restructure IPv4/IPv6 handling
Check whether interface is configured per IP type, not per DHCP. This is preparation to allow fallback to DHCP if static IP configuration is not available, which is the default option for MBIM modems Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
-rwxr-xr-xpackage/network/utils/umbim/files/lib/netifd/proto/mbim.sh54
1 files changed, 25 insertions, 29 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 e7866340ae..9af5b69ac1 100755
--- a/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh
+++ b/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh
@@ -171,15 +171,15 @@ _proto_mbim_setup() {
local zone="$(fw3 -q network "$interface" 2>/dev/null)"
- if [ -z "$dhcp" -o "$dhcp" = 0 ]; then
- echo "mbim[$$]" "Setting up $ifname"
- eval $(umbim $DBG -n -t $tid -d $device config | sed 's/: /=/g')
- tid=$((tid + 1))
+ echo "mbim[$$]" "Setting up $ifname"
+ eval $(umbim $DBG -n -t $tid -d $device config | sed 's/: /=/g')
+ tid=$((tid + 1))
- proto_init_update "$ifname" 1
- proto_send_update "$interface"
+ proto_init_update "$ifname" 1
+ proto_send_update "$interface"
- [ "$iptype" != "ipv6" ] && {
+ [ "$iptype" != "ipv6" ] && {
+ if [ -z "$dhcp" -o "$dhcp" = 0 ]; then
json_init
json_add_string name "${interface}_4"
json_add_string ifname "@$interface"
@@ -195,9 +195,21 @@ _proto_mbim_setup() {
[ -n "$zone" ] && json_add_string zone "$zone"
json_close_object
ubus call network add_dynamic "$(json_dump)"
- }
+ else
+ echo "mbim[$$]" "Starting DHCP on $ifname"
+ json_init
+ json_add_string name "${interface}_4"
+ json_add_string ifname "@$interface"
+ json_add_string proto "dhcp"
+ proto_add_dynamic_defaults
+ [ -n "$zone" ] && json_add_string zone "$zone"
+ json_close_object
+ ubus call network add_dynamic "$(json_dump)"
+ fi
+ }
- [ "$iptype" != "ipv4" ] && {
+ [ "$iptype" != "ipv4" ] && {
+ if [ -z "$dhcp" -o "$dhcp" = 0 ]; then
json_init
json_add_string name "${interface}_6"
json_add_string ifname "@$interface"
@@ -213,24 +225,8 @@ _proto_mbim_setup() {
[ -n "$zone" ] && json_add_string zone "$zone"
json_close_object
ubus call network add_dynamic "$(json_dump)"
- }
- else
- echo "mbim[$$]" "Starting DHCP on $ifname"
- proto_init_update "$ifname" 1
- proto_send_update "$interface"
-
- [ "$pdptype" = "ipv4" -o "$pdptype" = "ipv4v6" ] && {
- json_init
- json_add_string name "${interface}_4"
- json_add_string ifname "@$interface"
- json_add_string proto "dhcp"
- proto_add_dynamic_defaults
- [ -n "$zone" ] && json_add_string zone "$zone"
- json_close_object
- ubus call network add_dynamic "$(json_dump)"
- }
-
- [ "$pdptype" = "ipv6" -o "$pdptype" = "ipv4v6" ] && {
+ else
+ echo "mbim[$$]" "Starting DHCPv6 on $ifname"
json_init
json_add_string name "${interface}_6"
json_add_string ifname "@$interface"
@@ -240,8 +236,8 @@ _proto_mbim_setup() {
[ -n "$zone" ] && json_add_string zone "$zone"
json_close_object
ubus call network add_dynamic "$(json_dump)"
- }
- fi
+ fi
+ }
uci_set_state network $interface tid "$tid"
}