From patchwork Fri Jun 26 22:57:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wang X-Patchwork-Id: 1318162 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=jBSSeYOW; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=HuK+9ZoK; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::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 ozlabs.org (Postfix) with ESMTPS id 49tskY0K38z9sRk for ; Sat, 27 Jun 2020 08:58:44 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=m0tOproSk3BHt8NQPj8VKff3Uj8ILRAUIVtvf+dg4/M=; b=jBSSeYOWiqNc3RxTY7qDdnZm3T CKQY4Qua67af8ZKlRTtdQoCsdzjMYOyNRwY1vJMjXGwTs6e3CnMjEls3EXCXzMwr14P9N9/VNVet4 MYMt56gE02rOzxBCc/3jy7sNdU+9IjWFY9H88PWM+MTVl8NL/NV64e6ni7SluJMUokE4TYTx16YC9 Ufsz7UzW/aA8I5tjExqNbgqjTnVkN6DKO85EKN5NfoSzuLG1aRMi8vxYyltrACyNYNFGgSGnjSYrp 4n8HseheNQbnzebXIHwYBLGqA8gI6n5r7YqOI3mrJqMPPtnykmwC/USULFo8AFt3fkEgOO711ribP z+rnAVvQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1joxHh-0004X0-Nz; Fri, 26 Jun 2020 22:57:25 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1joxHa-0004Wb-V6 for hostap@lists.infradead.org; Fri, 26 Jun 2020 22:57:19 +0000 Received: by mail-pl1-x644.google.com with SMTP id y18so4820573plr.4 for ; Fri, 26 Jun 2020 15:57:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=LbewRfxj+or94yTNILKRrSJGCdDb71D+UASFVyoT3iQ=; b=HuK+9ZoKLGrRQFe9SwWSjIPFarSy4SzJrwle2aBgI4mWLdvgBUbhE9l2VS+eJKd4xX l5ZtkDjaRBFkXej9r8ne11nvd/wiswbxUOJlXRPRh6VEvFWmjt7Q3fGx8hRwlNrSCCzE mIo4dvX5gH2oLoMFrIcyVYgnb+z6jlXWddRiQ= 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:mime-version :content-transfer-encoding; bh=LbewRfxj+or94yTNILKRrSJGCdDb71D+UASFVyoT3iQ=; b=Kk+xhibXAiAJX44fQUL67Nuco45HDOtqZobe7/McOni/ogQlIN96aD24Wu3/0KLbaf 7pIagATt9D7XEQuYFqNENIsTyfbXtp3JcuccEmVJ9CDYeJ/U37XZJhbkfsF5dIc+3ITQ 0gvC9h3WL4hub1IqrYREVoHNfZCcKpIrKXwg7QReYs20gy0ccpDGeU2yRFYp1amlpMWC 1sxBR0e0TyaYaptaI68hnif/TVXs7T5lifIUqIhGjIfj/QbC/3Wm9DUPGkf+N4EQz/HM s0uvcduzf6zEZUyCgb9A0aBFPQ9fnBDxVBs/pjO6IVcL53ztETFUWdlP7yMCj2ZAnN4d J9gQ== X-Gm-Message-State: AOAM5306E99IoXifwLYZ6Boa5Sq3B/tdJKoPa+t6HJq6YGwN7eT9Dp7Y kPsyGOvQR55+SVqXDIZ63BlxLw== X-Google-Smtp-Source: ABdhPJy9wJlS1ATG3w+Pk7UXPC3FpEDSTkW3gSKlCJFH8vwe7Sl2qysdBB5KsHTemKZ8/HoyQAbUxA== X-Received: by 2002:a17:902:b698:: with SMTP id c24mr4381888pls.223.1593212235013; Fri, 26 Jun 2020 15:57:15 -0700 (PDT) Received: from localhost ([2620:15c:202:201:2b10:8627:31e7:c5ec]) by smtp.gmail.com with ESMTPSA id 25sm26421689pfi.7.2020.06.26.15.57.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 26 Jun 2020 15:57:14 -0700 (PDT) From: Matthew Wang To: j@w1.fi Subject: [PATCH 1/3] skip property update actions when wpa_config_set returns 1 Date: Fri, 26 Jun 2020 15:57:06 -0700 Message-Id: <20200626225708.429239-1-matthewmwang@chromium.org> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:644 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.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hostap@lists.infradead.org, Matthew Wang Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org When network properties are updated via dbus, wpa_config_set is used to update the property in the wpa_ssid struct. If it returns 1, the property was not changed and there's no need to perform any of the update actions. Signed-off-by: Matthew Wang --- wpa_supplicant/dbus/dbus_new_handlers.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c index d1f9607c6..93eeb30e1 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers.c +++ b/wpa_supplicant/dbus/dbus_new_handlers.c @@ -267,8 +267,15 @@ dbus_bool_t set_network_properties(struct wpa_supplicant *wpa_s, } else goto error; - if (wpa_config_set(ssid, entry.key, value, 0) < 0) + ret = wpa_config_set(ssid, entry.key, value, 0); + if (ret < 0) goto error; + if (ret == 1) { + os_free(value); + value = NULL; + wpa_dbus_dict_entry_clear(&entry); + continue; + } if (os_strcmp(entry.key, "bssid") != 0 && os_strcmp(entry.key, "priority") != 0)