[PATCH] Fix an endian bug in dbus properties.
Dan Williams
dcbw
Wed Jan 4 07:55:55 PST 2012
On Tue, 2012-01-03 at 17:24 +0100, Sylvestre Gallon wrote:
> Hi,
>
> Here is a patch to allow the use of Frequency and Signal DBus
> properties for Big Endian targets.
>
> I have tried NetworkManager on a powerpc target (BigEndian) and I find
> that these properties does not work (always 100% for Signal and 0 for
> Frequency). After some investigation I find that the bug come from an
> endian problem in wpa_supplicant (u32 to u16 data loss).
Good catch. Looks correct to me.
Dan
> Cheers,
>
> Signed-off-by: Sylvestre Gallon <ccna.syl at gmail.com>
> ---
> wpa_supplicant/dbus/dbus_new_handlers.c | 8 ++++++--
> 1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c
> b/wpa_supplicant/dbus/dbus_new_handlers.c
> index e3526d4..b03f1d7 100644
> --- a/wpa_supplicant/dbus/dbus_new_handlers.c
> +++ b/wpa_supplicant/dbus/dbus_new_handlers.c
> @@ -2809,13 +2809,15 @@ dbus_bool_t
> wpas_dbus_getter_bss_signal(DBusMessageIter *iter,
> {
> struct bss_handler_args *args = user_data;
> struct wpa_bss *res;
> + s16 level;
>
> res = get_bss_helper(args, error, __func__);
> if (!res)
> return FALSE;
>
> + level = (s16)res->level;
> return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_INT16,
> - &res->level, error);
> + &level, error);
> }
>
>
> @@ -2833,13 +2835,15 @@ dbus_bool_t
> wpas_dbus_getter_bss_frequency(DBusMessageIter *iter,
> {
> struct bss_handler_args *args = user_data;
> struct wpa_bss *res;
> + u16 freq;
>
> res = get_bss_helper(args, error, __func__);
> if (!res)
> return FALSE;
>
> + freq = (u16)res->freq;
> return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_UINT16,
> - &res->freq, error);
> + &freq, error);
> }
>
>
More information about the Hostap
mailing list