From patchwork Wed Jan 17 21:05:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaidong Wang X-Patchwork-Id: 1887621 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=pw6zjoX2; 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=VtlCZ+iI; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=198.137.202.133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TFdkT5bXgz23f1 for ; Thu, 18 Jan 2024 08:07:45 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :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=hVBkuVczb8czq2uTAIHl5gbayC+zFqqz/HqNW6+qj00=; b=pw6zjoX2Tas4DU fOEyWABAMdsENBNQuChCnTnn9NnqXTqCbdzLmQjLuMCBsbyt10QbQv9RN0mO5PXbMLAzMuq4+UMdb 0Jtggw0shY81y8g8sMiQSy/FusFcrsPrryWf+NtNmH2fWhLSSU4uxBd86oRTzbg3iVZuvHrG5Fzlv fTXmVGUEhaJqC1hOtDqp8/HVg/ltM/vja7MBj12Ss6ks84iX8qKvjVpbDe0AwTEPuMMaKPmkBw/1d GXupvKBuKx7M8BSpG3R3maGYkzXLC5c2iHbwYm2VSytcCav7Xwy6v+n/i7AcEnfsuLl2CX3AEvlT9 LKdwZNtEf8qTu8ZtEhog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQD7A-000jaQ-2a; Wed, 17 Jan 2024 21:06:24 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rQD77-000jZc-2G for hostap@lists.infradead.org; Wed, 17 Jan 2024 21:06:23 +0000 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1d6fbaaec91so5179845ad.3 for ; Wed, 17 Jan 2024 13:06:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1705525577; x=1706130377; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=8/peJS6yeXtCpRMstQca3M4FOkPbQG0ltObP+VDr9Ng=; b=VtlCZ+iINByotJnrc+VRhhxZk+Cw2nUoJu+h47CB/nW1NOkiYJhhRhUoRKcN4P63BP /7b/8d6w6mKTVBmtLT0SOWdjbIxzp7cQOBxtvBgwKqLqiQoimaICY8jLjq7PvW0cQ0B0 mbxUzOLG61ZeSm25H51KRtE65IXXcP53TFLxk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705525577; x=1706130377; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8/peJS6yeXtCpRMstQca3M4FOkPbQG0ltObP+VDr9Ng=; b=rLZ58hf0a5HeipVdMLyZGszpjbN5i+6TaSTVQ+FW3uXBoKpSHeHiKEYiBxYg59Z4Fp FsVGXcfhRDnPxpHVVU5cINjBnBntS/++BTjwcbzMzTdcWiiy59pqe5nDV7Q5UowawauD Q01WxQhHMYZ8RaL4ATerhHNLqosLqk8/acweoTo3Q8g8yez0M1ysgI8lXiv4ZZh832P9 3ToXNzfPmeG3qOqpVlHAKQTWfR6iVVWOhflBowlKNw5jdvv6KJ12F2j7xHzRZNaAqwvX gMWe+9mu/50ZkDJOhUU/BeS38hJpFT2C/g2NMO1uW33G9Eu8vI7K5ZmRBvJm4r8WxRJ0 ZRYQ== X-Gm-Message-State: AOJu0YzsyoZu9pbSySBLKAnK8fg6dsayjPPVr8uDDs8yJjJewvHvfhxz HLp7eZObQQ82lxOY2ArI60tT8xVjxVAVfqW+Hpvvy7jJRA== X-Google-Smtp-Source: AGHT+IGHaZ+jqvavhq1/TwWvbPnibCyYdlqCFGpOzxr6Ldt+xxZl63uTpPi0OQ+Fm88OzCsXoJEzEg== X-Received: by 2002:a17:902:7797:b0:1d7:4df:1998 with SMTP id o23-20020a170902779700b001d704df1998mr9701pll.53.1705525577337; Wed, 17 Jan 2024 13:06:17 -0800 (PST) Received: from kaidong.c.googlers.com.com (190.40.105.34.bc.googleusercontent.com. [34.105.40.190]) by smtp.gmail.com with ESMTPSA id jb19-20020a170903259300b001d6f496add8sm83316plb.304.2024.01.17.13.06.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 13:06:17 -0800 (PST) From: Kaidong Wang To: hostap@lists.infradead.org Cc: Kaidong Wang Subject: [PATCH] Fix the wrapping of dBus container for SignalPoll Date: Wed, 17 Jan 2024 21:05:57 +0000 Message-ID: <20240117210557.2606474-1-kaidong@chromium.org> X-Mailer: git-send-email 2.43.0.381.gb435a96ce8-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240117_130621_780273_9EE1CDA3 X-CRM114-Status: GOOD ( 12.07 ) X-Spam-Score: -0.4 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: SignalPoll is expected to return a dict, while the code wraps the dBus container as a variant, which leads to implicit unwrapping of variant. Wrap the dBus container as a dict for SignalPoll. Signed-off-by: Kaidong Wang --- wpa_supplicant/dbus/dbus_new_helpers.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) Content analysis details: (-0.4 points, 5.0 required) 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:634 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_AU Message has a valid DKIM or DK signature from author's domain -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_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org SignalPoll is expected to return a dict, while the code wraps the dBus container as a variant, which leads to implicit unwrapping of variant. Wrap the dBus container as a dict for SignalPoll. Signed-off-by: Kaidong Wang --- wpa_supplicant/dbus/dbus_new_helpers.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/wpa_supplicant/dbus/dbus_new_helpers.c b/wpa_supplicant/dbus/dbus_new_helpers.c index 7fb066991..bac66b87b 100644 --- a/wpa_supplicant/dbus/dbus_new_helpers.c +++ b/wpa_supplicant/dbus/dbus_new_helpers.c @@ -1046,7 +1046,7 @@ static double guard_interval_to_double(enum guard_interval value) /** * wpas_dbus_new_from_signal_information - Adds a wpa_signal_info * to a DBusMessage. - * @msg: Pointer to message to append fields to + * @iter: Pointer to message to append fields to * @si: Pointer to wpa_signal_info to add to the message * Returns: 0 on success, otherwise, an errorcode * @@ -1057,11 +1057,9 @@ static double guard_interval_to_double(enum guard_interval value) int wpas_dbus_new_from_signal_information(DBusMessageIter *iter, struct wpa_signal_info *si) { - DBusMessageIter iter_dict, variant_iter; + DBusMessageIter iter_dict; - if (!dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT, - "a{sv}", &variant_iter) || - !wpa_dbus_dict_open_write(&variant_iter, &iter_dict) || + if (!wpa_dbus_dict_open_write(iter, &iter_dict) || !wpa_dbus_dict_append_int32(&iter_dict, "rssi", si->data.signal) || !wpa_dbus_dict_append_uint32(&iter_dict, "linkspeed", @@ -1180,8 +1178,7 @@ int wpas_dbus_new_from_signal_information(DBusMessageIter *iter, ((si->data.flags & STA_DRV_DATA_TX_HE_DCM) && !wpa_dbus_dict_append_bool(&iter_dict, "tx-dcm", si->data.tx_dcm)) || - !wpa_dbus_dict_close_write(&variant_iter, &iter_dict) || - !dbus_message_iter_close_container(iter, &variant_iter)) + !wpa_dbus_dict_close_write(iter, &iter_dict)) return -ENOMEM; return 0;