[PATCH 2/6] nl80211: Convert some wpa_printf to wpa_msg methods.

Ben Greear greearb at candelatech.com
Thu Oct 20 18:07:33 EDT 2011


On 10/20/2011 12:08 PM, Jouni Malinen wrote:
> On Thu, Oct 20, 2011 at 06:34:30AM -0700, Ben Greear wrote:
>> On 10/20/2011 06:29 AM, Johannes Berg wrote:
>>> On Thu, 2011-10-20 at 06:24 -0700, Ben Greear wrote:
>> Hopefully the DEBUG messages don't show up by default anyway, and if someone
>> was crazy enough to try to parse them, then hopefully they are smart enough
>> to be clever with their parsing and able to deal with any issues.
>
> wpa_msg() calls at MSG_DEBUG level do not show up in the control
> interface by default. In theory, it would be possible to change the
> level, but I think I managed to break that operation at some point on
> the UNIX domain socket interface.. ;-)
>
>>>> But, I can change everything to wpa_lmsg or somthing that just logs
>>>> to a file if you prefer...
>>>
>>> That'd make more sense to me.
>>
>> Jouni:  Please let me know which you prefer.
>
> I don't see much need for adding new wrappers for debug messages, but I
> would prefer wpa_dbg() to be used instead of wpa_msg() when the message
> is at MSG_DEBUG (or below) level and is not really meant for anything
> parsing messages from the control interface. The main benefit here is
> that wpa_dbg() strings can be easily compiled out from the binary to
> minimize size requirements while wpa_msg() cannot be handled that easily
> since it is needed for ctrl_iface to work properly.

Something like this?  (But, many more conversions of course):

[greearb at build-32 hostap]$ git diff
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 271cca5..85eb120 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -457,10 +457,10 @@ static void wpa_driver_nl80211_event_link(struct wpa_driver_nl80211_data *drv,
         event.interface_status.ievent = del ? EVENT_INTERFACE_REMOVED :
                 EVENT_INTERFACE_ADDED;

-       wpa_printf(MSG_DEBUG, "RTM_%sLINK, IFLA_IFNAME: Interface '%s' %s",
-                  del ? "DEL" : "NEW",
-                  event.interface_status.ifname,
-                  del ? "removed" : "added");
+       wpa_dbg(drv->ctx, MSG_DEBUG, "RTM_%sLINK, IFLA_IFNAME: Interface '%s' %s",
+               del ? "DEL" : "NEW",
+               event.interface_status.ifname,
+               del ? "removed" : "added");

         if (os_strcmp(drv->first_bss.ifname, event.interface_status.ifname) == 0) {
                 if (del)


-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



More information about the HostAP mailing list