aboutsummaryrefslogtreecommitdiffstats
path: root/package/network
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2016-09-14 16:06:41 +0200
committerFelix Fietkau <nbd@nbd.name>2016-10-12 11:58:57 +0200
commit3b9b963e6e08eedcf4abff60998027018ab73ecd (patch)
tree0e240daf626aa48c7ada4f80f6626b63ae4efd8e /package/network
parent5abeba3450f0ca436a8e83089a0031fd279fc569 (diff)
downloadupstream-3b9b963e6e08eedcf4abff60998027018ab73ecd.tar.gz
upstream-3b9b963e6e08eedcf4abff60998027018ab73ecd.tar.bz2
upstream-3b9b963e6e08eedcf4abff60998027018ab73ecd.zip
uqmi: always use DHCP for IPv4
Commit 8f24ee638275 ("uqmi: Add proper IPv6 support") changed the code to fetch the IPv4 address via QMI by default instead of using DHCP to make it consistent with the IPv6 codepath. This breaks on at least some Sierra Wireless cards, where data exchanges fail to work until the host has fetched a DHCP lease. Leave v6 as it is, but always use DHCP for v4. Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'package/network')
-rwxr-xr-xpackage/network/utils/uqmi/files/lib/netifd/proto/qmi.sh84
1 files changed, 30 insertions, 54 deletions
diff --git a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
index 32df6ee9b1..81c1c3525f 100755
--- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
+++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
@@ -139,27 +139,20 @@ proto_qmi_setup() {
return 1
}
- if [ -z "$dhcp" -o "$dhcp" = 0 ]; then
- echo "Setting up $ifname"
- [ -n "$ipv4" ] && {
- json_load "$(uqmi -s -d $device --set-client-id wds,$cid_4 --get-current-settings)"
- json_select ipv4
- json_get_vars ip subnet gateway dns1 dns2
-
- proto_init_update "$ifname" 1
- proto_set_keep 1
- proto_add_ipv4_address "$ip" "$subnet"
- proto_add_dns_server "$dns1"
- proto_add_dns_server "$dns2"
- proto_add_ipv4_route "0.0.0.0" 0 "$gateway"
- proto_add_data
- json_add_string "cid_4" "$cid_4"
- json_add_string "pdh_4" "$pdh_4"
- proto_close_data
- proto_send_update "$interface"
- }
-
- [ -n "$ipv6" ] && {
+ echo "Setting up $ifname"
+ proto_init_update "$ifname" 1
+ proto_add_data
+ [ -n "$ipv4" ] && {
+ json_add_string "cid_4" "$cid_4"
+ json_add_string "pdh_4" "$pdh_4"
+ }
+ [ -n "$ipv6" ] && {
+ json_add_string "cid_6" "$cid_6"
+ json_add_string "pdh_6" "$pdh_6"
+ }
+
+ [ -n "$ipv6" ] && {
+ if [ -z "$dhcp" -o "$dhcp" = 0 ]; then
json_load "$(uqmi -s -d $device --set-client-id wds,$cid_6 --get-current-settings)"
json_select ipv6
json_get_var ip_6 ip
@@ -168,8 +161,6 @@ proto_qmi_setup() {
json_get_var dns2_6 dns2
json_get_var ip_prefix_length ip-prefix-length
- proto_init_update "$ifname" 1
- proto_set_keep 1
# RFC 7278: Extend an IPv6 /64 Prefix to LAN
proto_add_ipv6_address "$ip_6" "128"
proto_add_ipv6_prefix "${ip_6}/${ip_prefix_length}"
@@ -180,35 +171,7 @@ proto_qmi_setup() {
proto_add_data
json_add_string "cid_6" "$cid_6"
json_add_string "pdh_6" "$pdh_6"
- proto_close_data
- proto_send_update "$interface"
- }
- else
- echo "Starting DHCP on $ifname"
- proto_init_update "$ifname" 1
- proto_add_data
- [ -n "$ipv4" ] && {
- json_add_string "cid_4" "$cid_4"
- json_add_string "pdh_4" "$pdh_4"
- }
- [ -n "$ipv6" ] && {
- json_add_string "cid_6" "$cid_6"
- json_add_string "pdh_6" "$pdh_6"
- }
- proto_close_data
- proto_send_update "$interface"
-
- [ -n "$ipv4" ] && {
- json_init
- json_add_string name "${interface}_4"
- json_add_string ifname "@$interface"
- json_add_string proto "dhcp"
- json_add_int metric "$metric"
- json_close_object
- ubus call network add_dynamic "$(json_dump)"
- }
-
- [ -n "$ipv6" ] && {
+ else
json_init
json_add_string name "${interface}_6"
json_add_string ifname "@$interface"
@@ -218,8 +181,21 @@ proto_qmi_setup() {
json_add_string extendprefix 1
json_close_object
ubus call network add_dynamic "$(json_dump)"
- }
- fi
+ fi
+ }
+
+ proto_close_data
+ proto_send_update "$interface"
+
+ [ -n "$ipv4" ] && {
+ json_init
+ json_add_string name "${interface}_4"
+ json_add_string ifname "@$interface"
+ json_add_string proto "dhcp"
+ json_add_int metric "$metric"
+ json_close_object
+ ubus call network add_dynamic "$(json_dump)"
+ }
}
proto_qmi_teardown() {