From owner-freebsd-bugs@FreeBSD.ORG Fri Sep 7 21:40:02 2007 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1CE016A417 for ; Fri, 7 Sep 2007 21:40:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 965AD13C467 for ; Fri, 7 Sep 2007 21:40:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id l87Le2qv082200 for ; Fri, 7 Sep 2007 21:40:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id l87Le2q7082197; Fri, 7 Sep 2007 21:40:02 GMT (envelope-from gnats) Resent-Date: Fri, 7 Sep 2007 21:40:02 GMT Resent-Message-Id: <200709072140.l87Le2q7082197@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Artem Naluzhnyy Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9B2716A421 for ; Fri, 7 Sep 2007 21:39:06 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 906EA13C457 for ; Fri, 7 Sep 2007 21:39:06 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.1/8.14.1) with ESMTP id l87Ld6Ln075821 for ; Fri, 7 Sep 2007 21:39:06 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.1/8.14.1/Submit) id l87Ld6jP075820; Fri, 7 Sep 2007 21:39:06 GMT (envelope-from nobody) Message-Id: <200709072139.l87Ld6jP075820@www.freebsd.org> Date: Fri, 7 Sep 2007 21:39:06 GMT From: Artem Naluzhnyy To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/116190: [patch] add syslog support for wpa_supplicant X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Sep 2007 21:40:02 -0000 >Number: 116190 >Category: bin >Synopsis: [patch] add syslog support for wpa_supplicant >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Sep 07 21:40:02 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Artem Naluzhnyy >Release: 7.0-CURRENT >Organization: >Environment: FreeBSD tut.at.home 7.0-CURRENT FreeBSD 7.0-CURRENT #4: Tue Sep 4 18:10:44 EEST 2007 root@tut.at.home:/usr/obj/usr/src/sys/TUT i386 >Description: What about syslog capability for wpa_supplicant? See the patch attached. We also have to remove '-q' option from appropriate rc.d/wpa_supplicant script to set wpa_supplicant debug level back to normal: #------------------------------------------------------------ --- wpa_supplicant.orig 2005-10-20 01:26:47.000000000 +0300 +++ wpa_supplicant 2007-09-07 22:27:04.000000000 +0300 @@ -32,7 +32,7 @@ load_rc_config $name pid_file="/var/run/${name}/${ifn}.pid" -command_args="-B -q -i $ifn -c $conf_file -D $driver -P $pid_file" +command_args="-B -i $ifn -c $conf_file -D $driver -P $pid_file" required_files=$conf_file run_rc_command "$1" #------------------------------------------------------------ Here is an example of /var/log/messages for the default wpa_supplicant debug level: Sep 6 02:57:38 tut wpa_supplicant[86187]: Trying to associate with 00:19:5b:da:aa:fc (SSID='Blackhole' freq=2457 MHz) Sep 6 02:57:38 tut kernel: ath0: link state changed to UP Sep 6 02:57:38 tut wpa_supplicant[86187]: Associated with 00:19:5b:da:aa:fc Sep 6 02:57:38 tut wpa_supplicant[86187]: WPA: Key negotiation completed with 00:19:5b:da:aa:fc [PTK=CCMP GTK=TKIP] Sep 6 02:57:38 tut wpa_supplicant[86187]: CTRL-EVENT-CONNECTED - Connection to 00:19:5b:da:aa:fc completed (auth) [id=0 id_str=] Sep 6 02:57:45 tut dhclient: New IP Address (ath0): 192.168.0.180 Sep 6 02:57:45 tut dhclient: New Subnet Mask (ath0): 255.255.255.0 Sep 6 02:57:45 tut dhclient: New Broadcast Address (ath0): 192.168.0.255 Sep 6 02:57:45 tut dhclient: New Routers (ath0): 192.168.0.1 .. Sep 6 02:57:53 tut kernel: ath0: link state changed to DOWN Sep 6 02:57:53 tut wpa_supplicant[86187]: CTRL-EVENT-TERMINATING - signal 2 received Sep 6 02:57:53 tut dhclient[86212]: connection closed Sep 6 02:57:53 tut dhclient[86212]: exiting. >How-To-Repeat: >Fix: --- common.c.orig 2007-08-28 02:35:47.000000000 +0300 +++ common.c 2007-09-07 21:55:03.000000000 +0300 @@ -16,6 +16,7 @@ #include "common.h" +#include #ifdef CONFIG_DEBUG_FILE static FILE *out_file = NULL; @@ -177,6 +178,7 @@ void wpa_printf(int level, char *fmt, ...) { va_list ap; + int syslog_priority; va_start(ap, fmt); if (level >= wpa_debug_level) { @@ -192,6 +194,25 @@ #ifdef CONFIG_DEBUG_FILE } #endif /* CONFIG_DEBUG_FILE */ + + switch(level) { + case MSG_MSGDUMP: + case MSG_DEBUG: + syslog_priority = LOG_DEBUG; + break; + case MSG_INFO: + syslog_priority = LOG_NOTICE; + break; + case MSG_WARNING: + syslog_priority = LOG_WARNING; + break; + case MSG_ERROR: + syslog_priority = LOG_ERR; + break; + default: + syslog_priority = LOG_INFO; + } + vsyslog(syslog_priority, fmt, ap); } va_end(ap); } --- wpa_supplicant.c.orig 2007-08-28 02:35:56.000000000 +0300 +++ wpa_supplicant.c 2007-09-07 21:32:09.000000000 +0300 @@ -38,6 +38,8 @@ #include "wpa_ctrl.h" #include "mlme.h" +#include + const char *wpa_supplicant_version = "wpa_supplicant v" VERSION_STR "\n" "Copyright (c) 2003-2007, Jouni Malinen and contributors"; @@ -2484,6 +2486,8 @@ wpa_debug_use_file = params->wpa_debug_use_file; wpa_debug_open_file(); + openlog("wpa_supplicant", LOG_PID | LOG_NDELAY, LOG_DAEMON); + ret = eap_peer_register_methods(); if (ret) { wpa_printf(MSG_ERROR, "Failed to register EAP methods"); @@ -2609,5 +2613,6 @@ os_free(global->params.ctrl_interface); os_free(global); + closelog(); wpa_debug_close_file(); } >Release-Note: >Audit-Trail: >Unformatted: