Re: [PATCH v9 1/2] Add the similar USD APIs to dbus control interface that other apps can use the functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 05, 2024 at 01:43:38PM +0000, Chin-Ran Lo wrote:
> USD had a control interface commands and events defined for it. Extend
> this by providing similar USD APIs through the dbus control interface.

I applied these with quite a bit cleanup, including changes to the
interface definition:

https://w1.fi/cgit/hostap/commit/?id=dcf58aec8d3d2598f84e2789da16db16b8fa2bf3
https://w1.fi/cgit/hostap/commit/?id=85cd98976d0e2bbcb8d3e27330da47a6fd4f0403

> diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
> +void wpas_dbus_signal_nan_discovery_result(struct wpa_supplicant *wpa_s,

> +	dbus_bool_t succ;
> +	struct wpa_dbus_discov_info disc_info;

> +	succ = TRUE;
> +	disc_info.subscribe_id = subscribe_id;
> +	disc_info.peer_publish_id = peer_publish_id;
> +	os_memcpy(disc_info.peer_addr, peer_addr, ETH_ALEN);
> +	disc_info.fsd = fsd;
> +	disc_info.fsd_gas = fsd_gas;
> +	disc_info.ssi_len = ssi_len;
> +
> +	if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &succ) ||

I don't see any point in sending out a hardcoded succ=TRUE in the
signals, so I removed it.

> +		!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
> +		!wpa_dbus_dict_append_byte_array(&dict_iter, "discov_info",
> +						 (const char *) &disc_info,
> +						 sizeof(disc_info)) ||

Sending out a binary structure looks really wrong. The exact encoding of
this depends on implementation specific differences in the compiler,
e.g., as far as padding is concerned, and this might even leak private
memory in padding. I replaced this type of cases with struct members
getting encoded separately into the dict with appropriate type
information.

For the methods, I did not want to add new helper functions for parsing
dict members, so I replaced those with use of dbus_dict_helpers.c.

-- 
Jouni Malinen                                            PGP id EFC895FA

_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux