@ -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
[ -n " $ipv4 " ] && {
json_add_string "cid_4" " $cid_4 "
json_add_string "pdh_4" " $pdh_4 "
proto_close_data
proto_send_update " $interface "
}
[ -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,46 +171,31 @@ 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 name " ${ interface } _6 "
json_add_string ifname " @ $interface "
json_add_string proto "dhcp"
json_add_string proto "dhcpv6"
json_add_int metric " $metric "
# RFC 7278: Extend an IPv6 /64 Prefix to LAN
json_add_string extendprefix 1
json_close_object
ubus call network add_dynamic " $( json_dump) "
fi
}
[ -n " $ipv6 " ] && {
proto_close_data
proto_send_update " $interface "
[ -n " $ipv4 " ] && {
json_init
json_add_string name " ${ interface } _6 "
json_add_string name " ${ interface } _4 "
json_add_string ifname " @ $interface "
json_add_string proto "dhcpv6 "
json_add_string proto "dhcp"
json_add_int metric " $metric "
# RFC 7278: Extend an IPv6 /64 Prefix to LAN
json_add_string extendprefix 1
json_close_object
ubus call network add_dynamic " $( json_dump) "
}
fi
}
proto_qmi_teardown( ) {