[PATCH] Fix the wrapping of dBus container for SignalPoll
Kaidong Wang
kaidong at chromium.org
Wed Jan 17 13:05:57 PST 2024
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 <kaidong at chromium.org>
---
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;
--
2.43.0.381.gb435a96ce8-goog
More information about the Hostap
mailing list