diff options
author | Koen Vandeputte <koen.vandeputte@ncentric.com> | 2018-02-19 11:02:45 +0100 |
---|---|---|
committer | John Crispin <john@phrozen.org> | 2018-02-20 08:33:07 +0100 |
commit | e16cc7a8c8f32a0ec865d48735ac278845c6d582 (patch) | |
tree | b5a4fd9545ba301d7e4f8b3dbcf174c8611f00b4 | |
parent | 2f85985da245c1220695746384b9020dd6dc7848 (diff) | |
download | mtk-20170518-e16cc7a8c8f32a0ec865d48735ac278845c6d582.zip mtk-20170518-e16cc7a8c8f32a0ec865d48735ac278845c6d582.tar.gz mtk-20170518-e16cc7a8c8f32a0ec865d48735ac278845c6d582.tar.bz2 |
uqmi: ensure CID is a numeric value before proceeding
The current implementation only checked if uqmi itself executed
correctly which is also the case when the returned value is actually
an error.
Rework this, checking that CID is a numeric value, which can only
be true if uqmi itself also executed correctly.
Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
-rwxr-xr-x | package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh | 8 |
1 files changed, 4 insertions, 4 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 c3da5ed..46ea134 100755 --- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh +++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh @@ -140,11 +140,11 @@ proto_qmi_setup() { [ "$pdptype" = "ip" -o "$pdptype" = "ipv4v6" ] && { cid_4=$(uqmi -s -d "$device" --get-client-id wds) - [ $? -ne 0 ] && { + if ! [ "$cid_4" -eq "$cid_4" ] 2> /dev/null; then echo "Unable to obtain client ID" proto_notify_error "$interface" NO_CID return 1 - } + fi uqmi -s -d "$device" --set-client-id wds,"$cid_4" --set-ip-family ipv4 > /dev/null @@ -177,11 +177,11 @@ proto_qmi_setup() { [ "$pdptype" = "ipv6" -o "$pdptype" = "ipv4v6" ] && { cid_6=$(uqmi -s -d "$device" --get-client-id wds) - [ $? -ne 0 ] && { + if ! [ "$cid_6" -eq "$cid_6" ] 2> /dev/null; then echo "Unable to obtain client ID" proto_notify_error "$interface" NO_CID return 1 - } + fi uqmi -s -d "$device" --set-client-id wds,"$cid_6" --set-ip-family ipv6 > /dev/null |