From patchwork Thu Feb 15 14:16:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koen Vandeputte X-Patchwork-Id: 873895 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hapIrWHL"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ncentric.com header.i=@ncentric.com header.b="EBg8Y6ij"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zhz3g4zy3z9sRm for ; Fri, 16 Feb 2018 01:21:35 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9anMSoGrwfRjwFnytcIvkFOt8cEKnkVLSkoGNlRPFoM=; b=hapIrWHL2+tikg MfWcQxWMpYkhP0VK1RtNf0QVP0YMC3Fjr29Gx3Ur131WpeIDCLYUpUfPgrAOE3HLfldhtmPK2TdzG 3wf5JNo+1ARLsunriOvynsKm+pYPDZ0cGAs/f71nD1egpn9QVYN6byqpzmt0qxP9x6vwa6nMHEBxi G21ttNvTqbbopeMqSg+e+2cSuurXI8Xt+1iGzOXQ18sT8jwt0n3Kj8Vhs68UeGwbrD7+92ggnxaXZ NY6w1l9+MmKhSNK0WMTk2fg29gTYZr0bi+J7O5emO7AvgxzvuhYp7fPyNSIVf9kxSC713kyB2z68q dSIA82CAD8WTAF2rVQiw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1emKPj-00036R-BQ; Thu, 15 Feb 2018 14:21:31 +0000 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1emKLM-00075Q-DE for lede-dev@lists.infradead.org; Thu, 15 Feb 2018 14:17:13 +0000 Received: by mail-wm0-x235.google.com with SMTP id k87so1133144wmi.0 for ; Thu, 15 Feb 2018 06:16:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ncentric.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ooMc0XveajF2+xlkQQk1v3vTpQrYheD3XpzDKzuMmBU=; b=EBg8Y6ijLAUjKZhNbUt3Xb0bUbA5+/zcMS48Hk+CURL4v2l00hnJDkALTnk66Pj3oV sl4uevNuKeyu9hvKl9VnEhIOMSH9EfR0riNkm18V7kcgiBQsr3ULzrVO8L4aCmIO8cG2 +xGGBjNfImdN4IPjpsOj1m4DlWPpNg5lvsiWY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ooMc0XveajF2+xlkQQk1v3vTpQrYheD3XpzDKzuMmBU=; b=DbwsiFXVIsPalN9KbU5PKznvAStcOdrEz9hIGcHWTdBih//WPMckbCM9nQGxA+bcl8 hXpOMou0/oQxD46z51ucdiQ1Jgf9r90JN/H+sH9I/+tB0vw8ImxEhZwYAccV/9pmkoMB 2HaiIL7OWIaZkDTjWA3XZDHRuYhOxdYVJaYoV/Bt28IBIZr1MwtAkQoLv1Ddrz340FB2 SUzSmsUJIvCL3225GnZyB1Xx3txyExjRzXfL2Wwnmqa4TXcXU9kXJnbmqEOAtdXRg/YL 4ANetcEuigYt8PJqmXpzE0+PdB4qXhuH0YBa+L8gDcb4Je3/agw0flPhbHwpMIgbP8GF 9I9Q== X-Gm-Message-State: APf1xPB0lh7gxw8VboT+e5dRgkePGzn4mppQzQR+tVCuMfiuVaZdcCer U7o4Fn7WOXJM9V8Sfz9enDp/Ff4PTR8= X-Google-Smtp-Source: AH8x227ejAsqPvbmcswKAPg335uKZ/bOfc+TPwmB3LHA1bitSVlTBIkIvEBV5JwB2YaCjyvmIrcerQ== X-Received: by 10.80.180.184 with SMTP id w53mr3525672edd.149.1518704208199; Thu, 15 Feb 2018 06:16:48 -0800 (PST) Received: from localhost.localdomain (d515300d8.static.telenet.be. [81.83.0.216]) by smtp.googlemail.com with ESMTPSA id d6sm3462692edm.52.2018.02.15.06.16.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Feb 2018 06:16:47 -0800 (PST) From: Koen Vandeputte To: lede-dev@lists.infradead.org Date: Thu, 15 Feb 2018 15:16:03 +0100 Message-Id: <1518704164-22198-9-git-send-email-koen.vandeputte@ncentric.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518704164-22198-1-git-send-email-koen.vandeputte@ncentric.com> References: <1518704164-22198-1-git-send-email-koen.vandeputte@ncentric.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180215_061700_534763_C7EC1B3F X-CRM114-Status: GOOD ( 13.77 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:235 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Subject: [LEDE-DEV] [PATCH 8/9] uqmi: use built-in command for data-link verification X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: leventelist@gmail.com, lynxis@fe80.eu, Koen Vandeputte , john@phrozen.org, bjorn@mork.no, nbd@nbd.name MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org uqmi contains a command for directly querying the modem if there is a valid data connection, so let's use it. This avoids the cases were all previous tests are succesful, but the actual data link is not up for some reasons, leading to states were we thought the link was up when it actually wasn't .. Signed-off-by: Koen Vandeputte --- .../network/utils/uqmi/files/lib/netifd/proto/qmi.sh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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 bdab5ee5143b..c3da5ede26b1 100755 --- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh +++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh @@ -27,7 +27,7 @@ proto_qmi_init_config() { proto_qmi_setup() { local interface="$1" - local dataformat + local dataformat connstat local device apn auth username password pincode delay modes pdptype profile dhcpv6 autoconnect plmn $PROTO_DEFAULT_OPTIONS local cid_4 pdh_4 cid_6 pdh_6 local ip_6 ip_prefix_length gateway_6 dns1_6 dns2_6 @@ -164,6 +164,15 @@ proto_qmi_setup() { proto_notify_error "$interface" CALL_FAILED return 1 fi + + # Check data connection state + connstat=$(uqmi -s -d "$device" --get-data-status) + [ "$connstat" == '"connected"' ] || { + echo "No data link!" + uqmi -s -d "$device" --set-client-id wds,"$cid_4" --release-client-id wds + proto_notify_error "$interface" CALL_FAILED + return 1 + } } [ "$pdptype" = "ipv6" -o "$pdptype" = "ipv4v6" ] && { @@ -192,6 +201,15 @@ proto_qmi_setup() { proto_notify_error "$interface" CALL_FAILED return 1 fi + + # Check data connection state + connstat=$(uqmi -s -d "$device" --get-data-status) + [ "$connstat" == '"connected"' ] || { + echo "No data link!" + uqmi -s -d "$device" --set-client-id wds,"$cid_6" --release-client-id wds + proto_notify_error "$interface" CALL_FAILED + return 1 + } } echo "Setting up $ifname"