[PATCH] dbus: clean up new D-Bus interface getters and setters

Jouni Malinen j
Fri Jul 29 11:33:00 PDT 2011

On Wed, Jul 27, 2011 at 02:22:56PM -0500, Dan Williams wrote:
> A number of fixes/improvements here:

Thanks! Applied.

> 1) Remove casting of getter/setter function types which allows
> us to change the prototypes in the future and not have hard-to-find
> runtime segfaults
> 2) Instead of having the getters create a fake reply message which
> then gets its arguments copied into the real reply message, and is
> then disposed, just pass message iters around and have them add
> their arguments to the message itself
> 3) For setters, just pass in the message iter positioned at the
> start of the argument list, instead of each setter having to skip
> over the standard interface+property name
> 4) Convert error handling to use DBusError and return the error
> back down through the call stacks to the function that will
> actually send the error back to the caller, instead of having a
> fake DBusMessage of type DBUS_MESSAGE_TYPE_ERROR that then
> needs to have the error extracted from it.

Some time ago, I tried to understand the error message mechanism and
ended up wanting to clean it up after finally figuring out enough of
what it was doing.. This patch is very much appreciated in allowing me
not to go through that effort ;-).

> But most of all, this fixes various segfaults (like rh #725517
> and #678625) which were caused by some functions deep down in the
> getter callpaths wanting a source DBusMessage* when the getters were
> used for two things: signals (which don't have a source DBusMessage)
> and methods (which will have a source DBusMessage that's being
> replied to).  This duality made the code fragile when handling
> errors like invalid IEs over the air.

I think most (all?) of the error path segfaults should have been worked
around, but anyway, this is much better approach.

>  11 files changed, 1353 insertions(+), 1366 deletions(-)

This is large enough to not get on the mailing list as you noticed and I
should point out that I'm not the moderator for the list. As such, the
long message may be stuck in the moderator queue without making it to
the list before getting cleaned up by some timeout.. Anyway, the commit
is in the git repository now.

Jouni Malinen                                            PGP id EFC895FA

More information about the Hostap mailing list