[PATCH] wpa_supplicant: send a dbus reply only if requested by the caller

Dan Williams dcbw at redhat.com
Mon Feb 9 12:33:35 EST 2009


On Mon, 2009-02-09 at 17:32 +0100, Helmut Schaa wrote:
> Am Montag, 9. Februar 2009 schrieb Dan Williams:
> > On Mon, 2009-02-09 at 17:12 +0100, Helmut Schaa wrote:
> > > wpa_supplicant should not send a dbus reply as response to a method call if
> > > no reply was requested by the caller. Sending a reply even if not requested
> > > is basically no problem but triggers dbus warnings like the one below.
> > > 
> > > Feb  9 07:31:23 linux-gvjr dbus-daemon: Rejected send message, 2 matched rules;
> > > type="error", sender=":1.129" (uid=0 pid=30228 comm="/usr/sbin/wpa_supplicant
> > > -c /etc/wpa_supplicant/wp") interface="(unset)" member="(unset)" error
> > > name="fi.epitest.hostap.WPASupplicant.InvalidInterface" requested_reply=0
> > > destination=":1.128" (uid=0 pid=30226 comm="/usr/sbin/NetworkManager "))
> > 
> > Seems fine to me; upstream dbus devs recommend that language bindings
> > handle the no-reply bits themselves, but of course since we're not using
> > bindings here 
> 
> Exactly.
> 
> > (since wpa_supplicant itself can't link to glib or qt or 
> > whatever) it's got to be done manually.
> > 
> > Marcel and I have talked about implementing a replacement dbus interface
> > that would also support introspection;
> 
> Introspection would be indeed cool.
> 
> > which would probably fix many of 
> > these warnings.
> 
> Agreed.
> 
> > Might be a good time to start using a dbus helper 
> > library too.
> 
> Do you have something in mind already?

Not at this time; I'm not aware of a slightly higher-level C binding on
top of libdbus that doesn't use a mainloop we can link wpa_supplicant
to.  We actually don't want anything that uses an external mainloop,
because we'd need to use eloop internally.  Some nice things to make
easier: dict handling, object creation/registration, multiple interfaces
implemented by the same object, introspection based on what methods an
object supports, etc.  Maybe something like:

dbus_ctx = cdbus_context_create(DBUS_BUS_SYSTEM);
cdbus_context_register_bus_name(dbus_ctx, "fi.w1.Supplicant");

...

obj = cdbus_object_new (dbus_ctx, "/fi/w1/Supplicant");
cdbus_object_register_method(obj,
                             "fi.w1.Supplicant",
                             "DoSomething",
                             "b", /* return value */
                             "uua{sv}", /* arguments */
                             wpas_dbus_do_something,
                             <user data>);

obj2 = cdbus_object_new (dbus_ctx, "/fi/w1/Supplicant/Network/1");
cdbus_object_register_property(obj2,
                               "fi.w1.Supplicant.Network",
                               "Ssid",
                               "ay", /* signature */
                               wpas_dbus_network_get_ssid,
                               <user data>);

cdbus_object_register_signal(obj2,
                             "fi.w1.Supplicant.Network",
                             "Event",
                             "u");

...

DBusMessage *msg;
msg = cdbus_object_new_signal(obj2, "fi.w1.Supplicant.Network", "Event");
/* add arguments here with dbus_message_append */
cdbus_object_emit_signal(obj2, msg);

that sort of thing.

Dan




More information about the HostAP mailing list