From patchwork Thu Sep 19 10:22:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 832 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director7.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id AGsBKoXkg10VSgAAIUCqbw for ; Thu, 19 Sep 2019 16:26:45 -0400 Received: from proxy1.mail.ord1d.rsapps.net ([172.30.191.6]) by director7.mail.ord1d.rsapps.net with LMTP id kNyCKYXkg12+ewAAovjBpQ ; Thu, 19 Sep 2019 16:26:45 -0400 Received: from smtp14.gate.ord1c ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy1.mail.ord1d.rsapps.net with LMTP id yISdKYXkg13MGAAAasrz9Q ; Thu, 19 Sep 2019 16:26:45 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp14.gate.ord1c.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dmarc=none (p=nil; dis=none) header.from=unstable.cc X-Suspicious-Flag: YES X-Classification-ID: cbfbbe60-db1b-11e9-b4bd-bc305bf032e0-1-1 Received: from [216.105.38.7] ([216.105.38.7:58656] helo=lists.sourceforge.net) by smtp14.gate.ord1c.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id AC/0E-22695-484E38D5; Thu, 19 Sep 2019 16:26:45 -0400 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1iB2zn-0000XR-71; Thu, 19 Sep 2019 20:25:43 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1iB2zk-0000XJ-Na for openvpn-devel@lists.sourceforge.net; Thu, 19 Sep 2019 20:25:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=nyUl1PMKm+FB7wVP+1Hf9d4VjBTKTyQzxJ31XG1TIsE=; b=D7RzXEeMqK8SXUZCPwHsavTi9I qAhiCO0AEz4iIAlEsZ6wqCOUh7nnoaYytG16r6ptP6+9vtuyPNKqlxjjGEdGEzeVGjJ2GYY1pv3Vp WSA+DfTRoWqwsleFca74+RNhNlwfj0a6jbBrckq/wF6t4rEweYoAMhWe4+XlkwNCsje4=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=nyUl1PMKm+FB7wVP+1Hf9d4VjBTKTyQzxJ31XG1TIsE=; b=D hNP+0uHcoF3dz6xnnH20ZcfjKwKqpElabkcy3RM4BcGpOs7Si1A04hULMF8JENZ9k4IPJDh0UTPGk W/D1ysL/VIvi6G9ogD6LY/UqZo6ozubJB2WOUn5sbM1DakJvbnPNP7g1wFgLM4OOCcWkTFWK3lfkl rx3g4mNut0Au48lc=; Received: from s2.neomailbox.net ([5.148.176.60]) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1iB2zi-00B4Iq-LE for openvpn-devel@lists.sourceforge.net; Thu, 19 Sep 2019 20:25:40 +0000 From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Thu, 19 Sep 2019 22:22:57 +0200 Message-Id: <20190919202257.19405-1-a@unstable.cc> MIME-Version: 1.0 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: unstable.cc] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [5.148.176.60 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1iB2zi-00B4Iq-LE Subject: [Openvpn-devel] [PATCH] t_net.sh: execute sleep after checking exit code of previous command X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Antonio Quartulli Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox Ensure to check the exit code of the mktun command *before* running sleep, otherwise '$?' will resolve to the exit code of sleep itself, thus nullifying the check. Reported-by: Steffan Karger Signed-off-by: Antonio Quartulli Acked-by: Gert Doering --- tests/t_net.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/t_net.sh b/tests/t_net.sh index 97e947ab..49790f0f 100755 --- a/tests/t_net.sh +++ b/tests/t_net.sh @@ -35,17 +35,17 @@ reload_dummy() $RUN_SUDO $openvpn --dev $IFACE --dev-type tun --rmtun >/dev/null $RUN_SUDO $openvpn --dev $IFACE --dev-type tun --mktun >/dev/null + if [ $? -ne 0 ]; then + echo "can't create interface $IFACE" + exit 1 + fi + # it seems that tun devices will settle on NO-CARRIER while not connected to # any process, but this won't happen immediately. To avoid having the # NO-CARRIER bit appear in the middle of the tests - which would compromise # the results - let's wait 1 sec here for it to settle. sleep 1 - if [ $? -ne 0 ]; then - echo "can't create interface $IFACE" - exit 1 - fi - #ip link set dev $IFACE address 00:11:22:33:44:55 }