Skip to content

Commit

Permalink
uqmi: use correct value for connection checking
Browse files Browse the repository at this point in the history
Originally, the implementation only checked if uqmi command
execution succeeded properly without actually checking it's returned data.

This lead to a pass, even when the returned data was indicating an error.

Rework the verification to actually check the returned data,
which can only be correct if the uqmi command itself also executed correctly.

On command execution success, value "pdh_" is a pure numeric value.

Signed-off-by: Koen Vandeputte <[email protected]>
  • Loading branch information
Koen Vandeputte authored and blogic committed Feb 13, 2018
1 parent 3c54710 commit 3508f8a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,14 @@ proto_qmi_setup() {
${username:+--username $username} \
${password:+--password $password} \
${autoconnect:+--autoconnect})
[ $? -ne 0 ] && {

# pdh_4 is a numeric value on success
if ! [ "$pdh_4" -eq "$pdh_4" ] 2> /dev/null; then
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
}
fi
}

[ "$pdptype" = "ipv6" -o "$pdptype" = "ipv4v6" ] && {
Expand All @@ -182,12 +184,14 @@ proto_qmi_setup() {
${username:+--username $username} \
${password:+--password $password} \
${autoconnect:+--autoconnect})
[ $? -ne 0 ] && {

# pdh_6 is a numeric value on success
if ! [ "$pdh_6" -eq "$pdh_6" ] 2> /dev/null; then
echo "Unable to connect IPv6"
uqmi -s -d "$device" --set-client-id wds,"$cid_6" --release-client-id wds
proto_notify_error "$interface" CALL_FAILED
return 1
}
fi
}

echo "Setting up $ifname"
Expand Down

0 comments on commit 3508f8a

Please sign in to comment.