[openwrt/openwrt] umbim: include MBIM-provided DNS servers also with DHCP mode

LEDE Commits lede-commits at lists.infradead.org
Sat Apr 29 12:39:22 PDT 2023


hauke pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/d256ab730910a638dc61a2ee1c01576404dab52e

commit d256ab730910a638dc61a2ee1c01576404dab52e
Author: Lech Perczak <lech.perczak at gmail.com>
AuthorDate: Sat Nov 6 17:56:03 2021 +0100

    umbim: include MBIM-provided DNS servers also with DHCP mode
    
    In MBIM interfaces, DNS servers may be provided out-of-band regardless
    whether DHCP is used for configuration, or not. Move the DNS
    configuration outside "if" blocks to support that.
    
    Signed-off-by: Lech Perczak <lech.perczak at gmail.com>
---
 .../utils/umbim/files/lib/netifd/proto/mbim.sh     | 33 ++++++++++++----------
 1 file changed, 18 insertions(+), 15 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 da3f484223..bf07137fc4 100755
--- a/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh
+++ b/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh
@@ -217,18 +217,19 @@ _proto_mbim_setup() {
 			json_close_array
 
 			json_add_string gateway $(_proto_mbim_get_field ipv4gateway "$mbimconfig")
-
-			[ "$peerdns" = 0 ] || {
-				json_add_array dns
-				for server in $(_proto_mbim_get_field ipv4dnsserver "$mbimconfig"); do
-					json_add_string "" "$server"
-				done
-				json_close_array
-			}
 		elif [ "$dhcp" != 0 ]; then
 			echo "mbim[$$]" "Starting DHCP on $ifname"
 			json_add_string proto "dhcp"
 		fi
+
+		[ "$peerdns" = 0 ] || {
+			json_add_array dns
+			for server in $(_proto_mbim_get_field ipv4dnsserver "$mbimconfig"); do
+				json_add_string "" "$server"
+			done
+			json_close_array
+		}
+
 		proto_add_dynamic_defaults
 		[ -n "$zone" ] && json_add_string zone "$zone"
 		[ -n "$ip4table" ] && json_add_string ip4table "$ip4table"
@@ -258,18 +259,20 @@ _proto_mbim_setup() {
 
 			json_add_string ip6gw $(_proto_mbim_get_field ipv6gateway "$mbimconfig")
 
-			[ "$peerdns" = 0 ] || {
-				json_add_array dns
-				for server in $(_proto_mbim_get_field ipv6dnsserver "$mbimconfig"); do
-					json_add_string "" "$server"
-				done
-				json_close_array
-			}
 		elif [ "$dhcpv6" != 0 ]; then
 			echo "mbim[$$]" "Starting DHCPv6 on $ifname"
 			json_add_string proto "dhcpv6"
 			json_add_string extendprefix 1
 		fi
+
+		[ "$peerdns" = 0 ] || {
+			json_add_array dns
+			for server in $(_proto_mbim_get_field ipv6dnsserver "$mbimconfig"); do
+				json_add_string "" "$server"
+			done
+			json_close_array
+		}
+
 		proto_add_dynamic_defaults
 		[ -n "$zone" ] && json_add_string zone "$zone"
 		[ -n "$ip6table" ] && json_add_string ip6table "$ip6table"




More information about the lede-commits mailing list