Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
make wpa_supplicant automatically log
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
technopenguin
n00b
n00b


Joined: 05 Apr 2012
Posts: 12

PostPosted: Sun Jul 15, 2012 10:52 pm    Post subject: make wpa_supplicant automatically log Reply with quote

I wanted to debug wpa_supplicant by including a wpa.log file or the like under /var/log. I know I could do
wpa_supplicant -f /var/log/wpa.log
once I've logged on, but I wanted to see if I could make the logging start automatically, through configuration of /etc/conf.d/net. So far, I had
Code:
wpa_supplicant_wlan0="-f /var/log/wpa.log"

which didn't work, among similar variations, like no space between the 'f' and the directory.

I appreciate any help on this.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Mon Jul 16, 2012 12:24 am    Post subject: Re: make wpa_supplicant automatically log Reply with quote

technopenguin wrote:
I wanted to debug wpa_supplicant by including a wpa.log file or the like under /var/log. I know I could do wpa_supplicant -f /var/log/wpa.log

technopenguin ... you need to rebuild with 'debug' use set to get -f<debug file>, otherwise you only have syslog facility. Once this is enabled you will then be able to add "-f /var/log/wpa_supplicant.log" to wpa_supplicant_wlan0= in conf.d/net.

best ... khay
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1555
Location: Montréal

PostPosted: Mon Jul 16, 2012 2:07 am    Post subject: Reply with quote

I am not sure if it is necessary to set the debug USE flag to be able to use the -f switch of Wpa_supplicant. The -f switch refer to a log file. Log is not identical to debug. The -d switch refer to the debug verbosity level. That switch could need the debug USE flag to work.

One think that can be done before setting the debug USE flag is to start wpa_supplicant manually in command line with the -f switch activated and if needed in foreground to see if the logs output are write to the log file or shown to stdout when the -B switch is not used. I use Wpa_supplicant with the -f switch with others distributions, and it work as expected.
_________________
Paul
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Mon Jul 16, 2012 10:33 am    Post subject: Reply with quote

Logicien wrote:
I am not sure if it is necessary to set the debug USE flag to be able to use the -f switch of Wpa_supplicant. The -f switch refer to a log file. Log is not identical to debug.

Paul ... well, I am sure ... if I wasn't I would have said something more tentative than "you need [...]" ... and note in the --help "[-f<debug file>]" so it's not "logging" but "debug" ... logging is provided by the syslog facility.

best ... khay
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1555
Location: Montréal

PostPosted: Mon Jul 16, 2012 10:54 am    Post subject: Reply with quote

This is what I have in the man wpa_supplicant for the -d and -f switch:
Code:

man wpa_supplicant
,,,

-d     Increase debugging verbosity (-dd even more).

...

-f output file
              Log output to specified file instead of stdout.
...

The easiest way to debug problems, and to get debug log for bug reports, is  to  start  wpa_supplicant  on  foreground  with  debugging enabled:


              wpa_supplicant -c/etc/wpa_supplicant.conf -iwlan0 -d

...


Anyway, the debug USE flag can be usefull. It just about precision.
_________________
Paul
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Mon Jul 16, 2012 11:34 am    Post subject: Reply with quote

paul ... OK, but the manpage is imprecise in this instance. If you want to test then rebuild with USE="debug" and provide a "-f /var/log/wpa_supplicant.conf" in wpa_supplicant_wlan0= you'll see it works, but with USE="-debug" it won't.

The manpage assumes that 'debugging' is enabled (which is probably the default, and why it 'works' with other distros), with Gentoo this is optional based on USE.

I assure you this is correct ... so yes, precision.

best ... khay
Back to top
View user's profile Send private message
technopenguin
n00b
n00b


Joined: 05 Apr 2012
Posts: 12

PostPosted: Tue Jul 17, 2012 3:08 am    Post subject: Reply with quote

So, I have
config_wlan0=( "dhcp" )
modules=( "wpa_supplicant" )
wpa_supplicant_wlan0="-Dwext"
wpa_supplicant_wlan0=( "-f /var/log/wpa_supplicant.log" )
wpa_supplicant_wlan0=( "-dd" )

I know that last part works, since without the -dd, my /var/log/messages wouldn't have all the extra information. I was able to make the -f option work when starting wpa from the terminal myself (before, -f would give a usage error). I looked in the log file, and saw that it was basically everything in the messages file, just separate. I don't exactly need that separation, just the information, so I won't pursue this further too much, but if there is something I did wrong, and somebody knows what makes it work, I've recompiled so that the debug flag is included. There must be something to the configuration...
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Tue Jul 17, 2012 12:12 pm    Post subject: Reply with quote

technopenguin ...

wpa_supplicant_wlan0 is a variable, if you define it multiple times then the last will have precidence, hence the '-dd' working but the '-f' not. So ... combine the required options into one variable:

Code:
wpa_supplicant_wlan0="-Dwext -dd -f /var/log/wpa_supplicant.log"

Also the use of =( "foo" ) is depreciated, use ="foo" ..

best ... khay
Back to top
View user's profile Send private message
technopenguin
n00b
n00b


Joined: 05 Apr 2012
Posts: 12

PostPosted: Tue Jul 17, 2012 12:49 pm    Post subject: Reply with quote

This will help with debugging, now that I see the resultant log file. Thank you, that was extremely helpful! Many thanks to the both of you for your input and response :D
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum