<div class="gmail_quote">2010/10/6 Paul Stewart <span dir="ltr">&lt;<a href="mailto:pstew@google.com">pstew@google.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On Wed, Oct 6, 2010 at 7:02 AM, Dan Williams &lt;<a href="mailto:dcbw@redhat.com">dcbw@redhat.com</a>&gt; wrote:<br>
&gt; On Tue, 2010-10-05 at 12:07 -0700, Paul Stewart wrote:<br>
&gt;&gt; From: Paul Stewart &lt;<a href="mailto:pstew@google.com">pstew@google.com</a>&gt;<br>
&gt;&gt;<br>
&gt;&gt; The new DBus API helper function wpas_dbus_error_unknown_error<br>
&gt;&gt; function can be called as a result of a failure within internal<br>
&gt;&gt; getter calls, which will call this function with a NULL message<br>
&gt;&gt; parameter.  However, dbus_message_new_error looks very unkindly<br>
&gt;&gt; (i.e, abort()) on a NULL message, so in this case, we should not<br>
&gt;&gt; call it.<br>
&gt;&gt;<br>
&gt;&gt; I&#39;ve observed this course of events during a call to<br>
&gt;&gt; wpas_dbus_getter_bss_wpa with a faileld parse of the IE parameter.<br>
&gt;&gt; We got here through a call to fill_dict_with_properties which<br>
&gt;&gt; explicitly calls getters with a NULL message parameter.  Judging<br>
&gt;&gt; from the way it is called, this could easily occur if an AP sends<br>
&gt;&gt; out a malformed (or mis-received) probe response.  I usually run<br>
&gt;&gt; into this problem while driving through San Francisco, so I&#39;m<br>
&gt;&gt; exposed to any number of base stations along this path.<br>
&gt;<br>
&gt; I&#39;m thinking that instead, we should just pass the DBusMessage down to<br>
&gt; fill_dict_with_properties() so that they can do something intelligent<br>
&gt; with the error.  That would probably  mean changing the return type of<br>
&gt; fill_dict_with_properties() to a DBusMessage* which would be NULL on<br>
&gt; success, and an error message on error.<br>
&gt;<br>
&gt; Dan<br>
&gt;<br>
<br>
</div>The nature of fill_dict_with_properties is that it iterates over the<br>
properties and calls all getters.  The current behavior is tolerant of<br>
returned errors (continues if they occur) so that if there are any<br>
successfully retrieved properties, they are returned to the callers.<br>
Callers currently return their own error (&quot;No readable properties in<br>
this interface&quot;) if no properties are returned.  I don&#39;t think<br>
immediately replying to the caller with an error about a single<br>
property element in an iteration makes sense in this case.<br>
<br>
Also, there are times, such as the case where I ran into this problem,<br>
when there wasn&#39;t actually an incoming message to respond to, and<br>
instead, this was an outgoing signal:<br>
<br>
wpas_dbus_getter_bss_wpa &lt;- fill_dict_with_properties  &lt;-<br>
wpa_dbus_get_object_properties &lt;- wpas_dbus_signal_bss<br>
<br>
so, I believe that even if we resolved the first issue above, there<br>
are still legitimate cases where the reply_to would be NULL.<br>
<br>
--<br>
<font color="#888888">Paul<br></font></blockquote><div><br>I believe that the approach in that patch is fine but I would log the message coming in arg argument in case of NULL message so there would be any trace of the error left in logs.<br>
<br>Witek<br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><font color="#888888">
</font><div><div></div><div class="h5"><br>
&gt;&gt; ---<br>
&gt;&gt;  wpa_supplicant/dbus/dbus_new_handlers.c |   10 ++++++++++<br>
&gt;&gt;  1 files changed, 10 insertions(+), 0 deletions(-)<br>
&gt;&gt;<br>
&gt;&gt; diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c<br>
&gt;&gt; index 8e87e20..b9f6a8d 100644<br>
&gt;&gt; --- a/wpa_supplicant/dbus/dbus_new_handlers.c<br>
&gt;&gt; +++ b/wpa_supplicant/dbus/dbus_new_handlers.c<br>
&gt;&gt; @@ -117,6 +117,16 @@ static char * wpas_dbus_new_decompose_object_path(const char *path,<br>
&gt;&gt;  DBusMessage * wpas_dbus_error_unknown_error(DBusMessage *message,<br>
&gt;&gt;                                           const char *arg)<br>
&gt;&gt;  {<br>
&gt;&gt; +     /*<br>
&gt;&gt; +      * This function can be called as a result of a failure<br>
&gt;&gt; +      * within internal getter calls, which will call this function<br>
&gt;&gt; +      * with a NULL message parameter.  However, dbus_message_new_error<br>
&gt;&gt; +      * looks very unkindly (i.e, abort()) on a NULL message, so<br>
&gt;&gt; +      * in this case, we should not call it.<br>
&gt;&gt; +      */<br>
&gt;&gt; +     if (message == NULL)<br>
&gt;&gt; +             return NULL;<br>
&gt;&gt; +<br>
&gt;&gt;       return dbus_message_new_error(message, WPAS_DBUS_ERROR_UNKNOWN_ERROR,<br>
&gt;&gt;                                     arg);<br>
&gt;&gt;  }<br>
&gt;<br>
&gt;<br>
&gt;<br>
_______________________________________________<br>
HostAP mailing list<br>
<a href="mailto:HostAP@lists.shmoo.com">HostAP@lists.shmoo.com</a><br>
<a href="http://lists.shmoo.com/mailman/listinfo/hostap" target="_blank">http://lists.shmoo.com/mailman/listinfo/hostap</a><br>
</div></div></blockquote></div><br>