diff options
author | Lech Perczak <lech.perczak@gmail.com> | 2021-07-19 21:28:07 +0200 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2023-04-29 21:33:04 +0200 |
commit | ca8df8a992211c7f61434372b07afcbe0d94ff9f (patch) | |
tree | 636830d49fd5720fbeb34e09b7cdae8b702070d9 /package/network | |
parent | 464d81fe4a831181b2bb2a03b50442a86f3ce0be (diff) | |
download | upstream-ca8df8a992211c7f61434372b07afcbe0d94ff9f.tar.gz upstream-ca8df8a992211c7f61434372b07afcbe0d94ff9f.tar.bz2 upstream-ca8df8a992211c7f61434372b07afcbe0d94ff9f.zip |
umbim: use static config by default, fallback to DHCP
Finally, inspired by ModemManager's logic, make static configuration
obtained through MBIM control channel, preferred.
If IP configuration is not available this way, fallback to DHCP(v6) if
enabled, else do not create a sub-interface for unavailable IP type.
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
Diffstat (limited to 'package/network')
-rwxr-xr-x | package/network/utils/umbim/files/lib/netifd/proto/mbim.sh | 11 |
1 files changed, 7 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 d8df783a92..294dc64400 100755 --- a/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh +++ b/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh @@ -179,8 +179,11 @@ _proto_mbim_setup() { proto_init_update "$ifname" 1 proto_send_update "$interface" + [ -z "$dhcp" ] && dhcp=1 + [ -z "$dhcpv6" ] && dhcpv6=1 + [ "$iptype" != "ipv6" ] && { - if [ -z "$dhcp" -o "$dhcp" = 0 ]; then + if [ -n "$ipv4address" ]; then json_init json_add_string name "${interface}_4" json_add_string ifname "@$interface" @@ -196,7 +199,7 @@ _proto_mbim_setup() { [ -n "$zone" ] && json_add_string zone "$zone" json_close_object ubus call network add_dynamic "$(json_dump)" - else + elif [ "$dhcp" != 0 ]; then echo "mbim[$$]" "Starting DHCP on $ifname" json_init json_add_string name "${interface}_4" @@ -210,7 +213,7 @@ _proto_mbim_setup() { } [ "$iptype" != "ipv4" ] && { - if [ -z "$dhcpv6" -o "$dhcpv6" = 0 ]; then + if [ -n "$ipv6address" ]; then json_init json_add_string name "${interface}_6" json_add_string ifname "@$interface" @@ -226,7 +229,7 @@ _proto_mbim_setup() { [ -n "$zone" ] && json_add_string zone "$zone" json_close_object ubus call network add_dynamic "$(json_dump)" - else + elif [ "$dhcpv6" != 0 ]; then echo "mbim[$$]" "Starting DHCPv6 on $ifname" json_init json_add_string name "${interface}_6" |