From patchwork Fri Dec 31 15:29:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jouke Witteveen X-Patchwork-Id: 1999 Return-Path: Delivered-To: patchwork@archlinux.org Received: from mail.archlinux.org [2a01:4f9:c010:3052::1] by patchwork.archlinux.org with IMAP (fetchmail-6.4.25) for (single-drop); Fri, 31 Dec 2021 15:32:07 +0000 (UTC) Received: from mail.archlinux.org by mail.archlinux.org with LMTP id AIKEF3Yiz2El8gYAK+/4rw (envelope-from ) for ; Fri, 31 Dec 2021 15:32:06 +0000 Received: from lists.archlinux.org (lists.archlinux.org [IPv6:2a01:4f9:c010:9eb4::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.archlinux.org (Postfix) with ESMTPS id 9F304BCF64D; Fri, 31 Dec 2021 15:32:04 +0000 (UTC) Received: from lists.archlinux.org (localhost [IPv6:::1]) by lists.archlinux.org (Postfix) with ESMTP id DF0B2B51485; Fri, 31 Dec 2021 15:32:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.archlinux.org; s=dkim-rsa; t=1640964724; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=T6MNI7J5o0Vp6PREEorhSV/0GQeJD1/NyOeS2ZF6mbs=; b=3v1PtAWC6xKjkK0x/QXsArztNtpZjQFjYWo3LG7HnzyIS5Trrgb4OtPJfpdB1lwM4A1i9h bMeUL/egGiDBm7DNvCPW7VKOwr9FveUQSAzZVWrPE37j/FqV0bQGVOM7wU6DyE9ViFQkIX b+3U8aX00DIdS+ZrJF0njQ5PxopoEr6kToEtz32UpD39IhaMPdPjDwgT0c2MjANQMR33nA eO09P+msc14ofu5pEAQFWJ54NXHA9ZRKdE2osreaQGPhxpJd7y+X+tJdBBYoqfc02mNqoi T1wf2MoTRVZkuv2tcOY+A7wjgSKei/8YpKeMj6PIJzBl8jx+RSKCvhrXzi5YTXxs8ZHJiK 5YI6VwXpo89bDXs5xd0ePRXS02Eh/UDcmVQAph7PrJxon9L60BicNKxjc8dChFWTCOmTaZ KQa/2plwAsdk2P3NuMAy5hLGsY4y7hHgQRuYyWYLRRJgssyJM2/EkkMLfoTQniAk7OiCTc T0i9TD2Iw8zPgrByazsuPE3K0MfnfJcLt8F40MpIqh0g8Nkt8c1QYvBmzWaxmG+vHoiD4l Wfn7EUOOxGp/gRdrZD5/gCluxjUyRISbpqlPRnQzhWOpmSph9+/1bu7t4qwbNLwTFjHnbt h9+qMpzYUOnkSX1uEfyW8enHO4B7Q3QM1lb3YLqaxrL+zoNUCKz3s= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=lists.archlinux.org; s=dkim-ed25519; t=1640964724; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=T6MNI7J5o0Vp6PREEorhSV/0GQeJD1/NyOeS2ZF6mbs=; b=zyyfayBKYuDoCMDKQ1VDY/g4JcRFRnpEV2NBWrK1eCu8g730fWvlMxoKOoVSdLADl/ah5X 1yPBmU7yrrqAORCA== X-Original-To: arch-projects@lists.archlinux.org Delivered-To: arch-projects@lists.archlinux.org Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lists.archlinux.org (Postfix) with ESMTPS id 577C0B51414 for ; Fri, 31 Dec 2021 15:29:30 +0000 (UTC) Received: by mail-ed1-x534.google.com with SMTP id z9so39963823edm.10 for ; Fri, 31 Dec 2021 07:29:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition; bh=T6MNI7J5o0Vp6PREEorhSV/0GQeJD1/NyOeS2ZF6mbs=; b=g4gSPMkrP0Erqu0hOHjmDdU0QCpkfSAheugT1Z3nY5Nsb7OelfEkGml/5plP+KaxTY BlsugY9361fEEXoYWNpkpjK6oy8MVDVCUJ6hx4wPsH9gxE4svYA6k4NSNLBpPZSwEZkK 7ftC9/5PHNNZLGrmoaxBTtkHG6HHY9L0iOeKEtGCsG72qIXVwmCSgYB87PocrbU2zBTa Ou2BUr1GZikxQxkJO/3M3uIvbkq+zPyd47jA+ZC6aFUqs/3zKb3EMHKLflLoZtBZY6N9 rwJlF8V1t79dk42Hqiy4Rk3FmYrBF0mFMqlRPeWOuL0SyEQdQfp7fBa6MbDf5y7cixhB 6rIA== X-Gm-Message-State: AOAM531Rq0t8xWGYI04hQ+DTTFNN6LzbRf7jTJU8VmSKeeFmd+awFD2U srro4KSVDf3LAwTk2Ime5bQmapEKaMZ/aQ== X-Google-Smtp-Source: ABdhPJxZbuwaRgQXruOWagaax69bXsMwbH8kv1v0u7KqwOW83DA9d3qS03cy0TJo+0x1RCTh2S0gxQ== X-Received: by 2002:a17:907:760b:: with SMTP id jx11mr22524949ejc.99.1640964569621; Fri, 31 Dec 2021 07:29:29 -0800 (PST) Received: from Mindship-06.localdomain (252-168-166-62.ftth.glasoperator.nl. [62.166.168.252]) by smtp.gmail.com with ESMTPSA id k16sm8484822ejk.172.2021.12.31.07.29.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Dec 2021 07:29:29 -0800 (PST) Date: Fri, 31 Dec 2021 16:29:26 +0100 To: arch-projects@lists.archlinux.org Message-ID: MIME-Version: 1.0 Content-Disposition: inline Subject: [arch-projects] [netctl][PATCH] Catch connection failures from wifi-menu X-BeenThere: arch-projects@lists.archlinux.org X-Mailman-Version: 2.1.39 Precedence: list List-Id: Arch Linux projects development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jouke Witteveen via arch-projects From: Jouke Witteveen Reply-To: Arch Linux projects development discussion Cc: Jouke Witteveen Errors-To: arch-projects-bounces@lists.archlinux.org Sender: "arch-projects" Authentication-Results: mail.archlinux.org; dkim=pass header.d=lists.archlinux.org header.s=dkim-rsa header.b=3v1PtAWC; dkim=pass header.d=lists.archlinux.org header.s=dkim-ed25519 header.b=zyyfayBK; dmarc=pass (policy=none) header.from=archlinux.org; spf=pass (mail.archlinux.org: domain of arch-projects-bounces@lists.archlinux.org designates 2a01:4f9:c010:9eb4::1 as permitted sender) smtp.mailfrom=arch-projects-bounces@lists.archlinux.org X-Rspamd-Queue-Id: 9F304BCF64D X-Spamd-Result: default: False [-3.91 / 15.00]; DWL_DNSWL_MED(-2.00)[archlinux.org:dkim]; DMARC_POLICY_ALLOW(-0.50)[archlinux.org,none]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; R_SPF_ALLOW(-0.20)[+ip6:2a01:4f9:c010:9eb4::1]; RCVD_IN_DNSWL_MED(-0.20)[2a01:4f9:c010:9eb4::1:from]; MAILLIST(-0.20)[mailman]; R_DKIM_ALLOW(-0.20)[lists.archlinux.org:s=dkim-rsa,lists.archlinux.org:s=dkim-ed25519]; MIME_GOOD(-0.10)[text/plain]; HAS_LIST_UNSUB(-0.01)[]; RCVD_COUNT_FIVE(0.00)[5]; FROM_HAS_DN(0.00)[]; TAGGED_RCPT(0.00)[]; HAS_REPLYTO(0.00)[arch-projects@lists.archlinux.org]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::534:received]; PREVIOUSLY_DELIVERED(0.00)[arch-projects@lists.archlinux.org]; NEURAL_HAM(-0.00)[-1.000]; ARC_NA(0.00)[]; ASN(0.00)[asn:24940, ipnet:2a01:4f9::/32, country:DE]; FREEMAIL_CC(0.00)[gmail.com]; REPLYTO_ADDR_EQ_FROM(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_NEQ_ENVFROM(0.00)[arch-projects@lists.archlinux.org,arch-projects-bounces@lists.archlinux.org]; DKIM_TRACE(0.00)[lists.archlinux.org:+]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FORGED_SENDER_MAILLIST(0.00)[] X-Rspamd-Server: mail.archlinux.org Wireless connections yield before the password is checked, so it is better to wait for a connection to come online before concluding the generated profile works. --- src/netctl.in | 11 +++++++---- src/wifi-menu | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/netctl.in b/src/netctl.in index 3a96f12..c5f3cb7 100644 --- a/src/netctl.in +++ b/src/netctl.in @@ -129,10 +129,13 @@ unit_reenable() { wait_online() { local profile="$1" - if sd_call "is-active --quiet" "$profile"; then - timeout_wait "${TIMEOUT_ONLINE:-120}" \ - '[[ $(sd_status_text "$profile") == "online" ]]' - else + if ! timeout_wait "${TIMEOUT_ONLINE:-120}" \ + '! sd_call "is-active --quiet" "$profile" || \ + [[ $(sd_status_text "$profile") == "online" ]]'; then + report_notice "timeout" + return 1 + elif ! sd_call "is-active --quiet" "$profile"; then + report_notice "failed" return 1 fi } diff --git a/src/wifi-menu b/src/wifi-menu index f2030ae..21752ea 100755 --- a/src/wifi-menu +++ b/src/wifi-menu @@ -196,7 +196,7 @@ connect_to_ssid() { do_debug systemctl restart "netctl-auto@$INTERFACE.service" fi do_debug netctl-auto switch-to "$PROFILE" - elif ! netctl switch-to "$PROFILE"; then + elif ! netctl switch-to "$PROFILE" || ! netctl wait-online "$PROFILE"; then if is_yes "${NEW_PROFILE:-no}"; then msg=" CONNECTING FAILED