- pdh_4=`uqmi -s -d "$device" --set-client-id wds,"$cid_4" \
- --start-network "$apn" \
- ${auth:+--auth-type $auth} \
- ${username:+--username $username} \
- ${password:+--password $password} \
- --ip-family ipv4 \
- --autoconnect`
- [ $? -ne 0 ] && {
- echo "Unable to connect IPv4"
- uqmi -s -d "$device" --set-client-id wds,"$cid_4" --release-client-id wds
- ipv4=""
+ uqmi -s -d "$device" --set-client-id wds,"$cid_4" --set-ip-family ipv4 > /dev/null
+
+ # try to clear previous autoconnect state
+ uqmi -s -d "$device" --set-client-id wds,"$cid_4" \
+ --stop-network 0xffffffff \
+ --autoconnect > /dev/null
+
+ pdh_4=`uqmi -s -d "$device" --set-client-id wds,"$cid_4" \
+ --start-network \
+ ${apn:+--apn $apn} \
+ ${profile:+--profile $profile} \
+ ${auth:+--auth-type $auth} \
+ ${username:+--username $username} \
+ ${password:+--password $password} \
+ ${autoconnect:+--autoconnect}`
+ [ $? -ne 0 ] && {
+ echo "Unable to connect IPv4"
+ uqmi -s -d "$device" --set-client-id wds,"$cid_4" --release-client-id wds
+ proto_notify_error "$interface" CALL_FAILED
+ return 1
+ }