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@gmail.com>
This commit is contained in:
Lech Perczak 2021-11-06 17:56:03 +01:00 committed by Hauke Mehrtens
parent aa7873a9e6
commit d256ab7309

View File

@ -217,6 +217,10 @@ _proto_mbim_setup() {
json_close_array
json_add_string gateway $(_proto_mbim_get_field ipv4gateway "$mbimconfig")
elif [ "$dhcp" != 0 ]; then
echo "mbim[$$]" "Starting DHCP on $ifname"
json_add_string proto "dhcp"
fi
[ "$peerdns" = 0 ] || {
json_add_array dns
@ -225,10 +229,7 @@ _proto_mbim_setup() {
done
json_close_array
}
elif [ "$dhcp" != 0 ]; then
echo "mbim[$$]" "Starting DHCP on $ifname"
json_add_string proto "dhcp"
fi
proto_add_dynamic_defaults
[ -n "$zone" ] && json_add_string zone "$zone"
[ -n "$ip4table" ] && json_add_string ip4table "$ip4table"
@ -258,6 +259,12 @@ _proto_mbim_setup() {
json_add_string ip6gw $(_proto_mbim_get_field ipv6gateway "$mbimconfig")
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
@ -265,11 +272,7 @@ _proto_mbim_setup() {
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
proto_add_dynamic_defaults
[ -n "$zone" ] && json_add_string zone "$zone"
[ -n "$ip6table" ] && json_add_string ip6table "$ip6table"