aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/utils/uqmi/files/lib/netifd/proto
diff options
context:
space:
mode:
Diffstat (limited to 'package/network/utils/uqmi/files/lib/netifd/proto')
-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() {