bring in local changes for:
CONFIG_DEBUG_SYSLOG CONFIG_TERMINATE_ONLASTIF EAP_SERVER
This commit is contained in:
parent
2af41b09fa
commit
3cac7b891b
@ -1910,10 +1910,12 @@ int main(int argc, char *argv[])
|
||||
if (optind == argc)
|
||||
usage();
|
||||
|
||||
#ifdef EAP_SERVER
|
||||
if (eap_server_register_methods()) {
|
||||
wpa_printf(MSG_ERROR, "Failed to register EAP methods");
|
||||
return -1;
|
||||
}
|
||||
#endif /* EAP_SERVER */
|
||||
|
||||
interfaces.count = argc - optind;
|
||||
|
||||
@ -2019,7 +2021,9 @@ int main(int argc, char *argv[])
|
||||
closelog();
|
||||
#endif /* CONFIG_NATIVE_WINDOWS */
|
||||
|
||||
#ifdef EAP_SERVER
|
||||
eap_server_unregister_methods();
|
||||
#endif /* EAP_SERVER */
|
||||
|
||||
os_daemonize_terminate(pid_file);
|
||||
|
||||
|
@ -16,6 +16,10 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef CONFIG_DEBUG_SYSLOG
|
||||
#include <syslog.h>
|
||||
#endif /* CONFIG_DEBUG_SYSLOG */
|
||||
|
||||
|
||||
#ifdef CONFIG_DEBUG_FILE
|
||||
static FILE *out_file = NULL;
|
||||
@ -23,6 +27,7 @@ static FILE *out_file = NULL;
|
||||
int wpa_debug_level = MSG_INFO;
|
||||
int wpa_debug_show_keys = 0;
|
||||
int wpa_debug_timestamp = 0;
|
||||
int wpa_debug_syslog = 0;
|
||||
|
||||
|
||||
#ifndef CONFIG_NO_STDOUT_DEBUG
|
||||
@ -44,6 +49,40 @@ void wpa_debug_print_timestamp(void)
|
||||
printf("%ld.%06u: ", (long) tv.sec, (unsigned int) tv.usec);
|
||||
}
|
||||
|
||||
void wpa_debug_open_syslog(void)
|
||||
{
|
||||
#ifdef CONFIG_DEBUG_SYSLOG
|
||||
openlog("wpa_supplicant", LOG_PID | LOG_NDELAY, LOG_DAEMON);
|
||||
wpa_debug_syslog++;
|
||||
#endif
|
||||
}
|
||||
|
||||
void wpa_debug_close_syslog(void)
|
||||
{
|
||||
#ifdef CONFIG_DEBUG_SYSLOG
|
||||
if (wpa_debug_syslog)
|
||||
closelog();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEBUG_SYSLOG
|
||||
static int syslog_priority(int level)
|
||||
{
|
||||
switch (level) {
|
||||
case MSG_MSGDUMP:
|
||||
case MSG_DEBUG:
|
||||
return LOG_DEBUG;
|
||||
case MSG_INFO:
|
||||
return LOG_NOTICE;
|
||||
case MSG_WARNING:
|
||||
return LOG_WARNING;
|
||||
case MSG_ERROR:
|
||||
return LOG_ERR;
|
||||
}
|
||||
return LOG_INFO;
|
||||
}
|
||||
#endif /* CONFIG_DEBUG_SYSLOG */
|
||||
|
||||
|
||||
/**
|
||||
* wpa_printf - conditional printf
|
||||
@ -62,6 +101,11 @@ void wpa_printf(int level, char *fmt, ...)
|
||||
|
||||
va_start(ap, fmt);
|
||||
if (level >= wpa_debug_level) {
|
||||
#ifdef CONFIG_DEBUG_SYSLOG
|
||||
if (wpa_debug_syslog) {
|
||||
vsyslog(syslog_priority(level), fmt, ap);
|
||||
} else {
|
||||
#endif /* CONFIG_DEBUG_SYSLOG */
|
||||
wpa_debug_print_timestamp();
|
||||
#ifdef CONFIG_DEBUG_FILE
|
||||
if (out_file) {
|
||||
@ -74,6 +118,9 @@ void wpa_printf(int level, char *fmt, ...)
|
||||
#ifdef CONFIG_DEBUG_FILE
|
||||
}
|
||||
#endif /* CONFIG_DEBUG_FILE */
|
||||
#ifdef CONFIG_DEBUG_SYSLOG
|
||||
}
|
||||
#endif /* CONFIG_DEBUG_SYSLOG */
|
||||
}
|
||||
va_end(ap);
|
||||
}
|
||||
|
@ -1011,6 +1011,18 @@ wpa_supplicant_event_michael_mic_failure(struct wpa_supplicant *wpa_s,
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_TERMINATE_ONLASTIF
|
||||
static int any_interfaces(struct wpa_supplicant *head)
|
||||
{
|
||||
struct wpa_supplicant *wpa_s;
|
||||
|
||||
for (wpa_s = head; wpa_s != NULL; wpa_s = wpa_s->next)
|
||||
if (!wpa_s->interface_removed)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_TERMINATE_ONLASTIF */
|
||||
|
||||
static void
|
||||
wpa_supplicant_event_interface_status(struct wpa_supplicant *wpa_s,
|
||||
union wpa_event_data *data)
|
||||
@ -1035,6 +1047,11 @@ wpa_supplicant_event_interface_status(struct wpa_supplicant *wpa_s,
|
||||
wpa_supplicant_mark_disassoc(wpa_s);
|
||||
l2_packet_deinit(wpa_s->l2);
|
||||
wpa_s->l2 = NULL;
|
||||
#ifdef CONFIG_TERMINATE_ONLASTIF
|
||||
/* check if last interface */
|
||||
if (!any_interfaces(wpa_s->global->ifaces))
|
||||
eloop_terminate();
|
||||
#endif /* CONFIG_TERMINATE_ONLASTIF */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -26,11 +26,23 @@ static void usage(void)
|
||||
int i;
|
||||
printf("%s\n\n%s\n"
|
||||
"usage:\n"
|
||||
" wpa_supplicant [-BddhKLqqtuvW] [-P<pid file>] "
|
||||
" wpa_supplicant [-BddhKLqq"
|
||||
#ifdef CONFIG_DEBUG_SYSLOG
|
||||
"s"
|
||||
#endif /* CONFIG_DEBUG_SYSLOG */
|
||||
"t"
|
||||
#ifdef CONFIG_CTRL_IFACE_DBUS
|
||||
"u"
|
||||
#endif /* CONFIG_CTRL_IFACE_DBUS */
|
||||
"vW] [-P<pid file>] "
|
||||
"[-g<global ctrl>] \\\n"
|
||||
" -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] "
|
||||
"[-p<driver_param>] \\\n"
|
||||
" [-b<br_ifname>] [-f<debug file>] \\\n"
|
||||
" [-b<br_ifname>]"
|
||||
#ifdef CONFIG_DEBUG_FILE
|
||||
" [-f<debug file>]"
|
||||
#endif /* CONFIG_DEBUG_FILE */
|
||||
" \\\n"
|
||||
" [-N -i<ifname> -c<conf> [-C<ctrl>] "
|
||||
"[-D<driver>] \\\n"
|
||||
" [-p<driver_param>] [-b<br_ifname>] ...]\n"
|
||||
@ -58,6 +70,9 @@ static void usage(void)
|
||||
#endif /* CONFIG_DEBUG_FILE */
|
||||
" -g = global ctrl_interface\n"
|
||||
" -K = include keys (passwords, etc.) in debug output\n"
|
||||
#ifdef CONFIG_DEBUG_SYSLOG
|
||||
" -s = log output to syslog instead of stdout\n"
|
||||
#endif /* CONFIG_DEBUG_SYSLOG */
|
||||
" -t = include timestamp in debug messages\n"
|
||||
" -h = show this help text\n"
|
||||
" -L = show license (GPL and BSD)\n");
|
||||
@ -72,7 +87,9 @@ static void usage(void)
|
||||
" -N = start describing new interface\n");
|
||||
|
||||
printf("example:\n"
|
||||
" wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf\n");
|
||||
" wpa_supplicant -D%s -iwlan0 -c/etc/wpa_supplicant.conf\n",
|
||||
wpa_supplicant_drivers[i] ?
|
||||
wpa_supplicant_drivers[i]->name : "wext");
|
||||
#endif /* CONFIG_NO_STDOUT_DEBUG */
|
||||
}
|
||||
|
||||
@ -133,7 +150,7 @@ int main(int argc, char *argv[])
|
||||
wpa_supplicant_fd_workaround();
|
||||
|
||||
for (;;) {
|
||||
c = getopt(argc, argv, "b:Bc:C:D:df:g:hi:KLNp:P:qtuvW");
|
||||
c = getopt(argc, argv, "b:Bc:C:D:df:g:hi:KLNp:P:qstuvW");
|
||||
if (c < 0)
|
||||
break;
|
||||
switch (c) {
|
||||
@ -194,6 +211,11 @@ int main(int argc, char *argv[])
|
||||
case 'q':
|
||||
params.wpa_debug_level++;
|
||||
break;
|
||||
#ifdef CONFIG_DEBUG_SYSLOG
|
||||
case 's':
|
||||
params.wpa_debug_syslog++;
|
||||
break;
|
||||
#endif /* CONFIG_DEBUG_SYSLOG */
|
||||
case 't':
|
||||
params.wpa_debug_timestamp++;
|
||||
break;
|
||||
|
@ -2016,6 +2016,8 @@ struct wpa_global * wpa_supplicant_init(struct wpa_params *params)
|
||||
return NULL;
|
||||
|
||||
wpa_debug_open_file(params->wpa_debug_file_path);
|
||||
if (params->wpa_debug_syslog)
|
||||
wpa_debug_open_syslog();
|
||||
|
||||
ret = eap_peer_register_methods();
|
||||
if (ret) {
|
||||
@ -2166,5 +2168,6 @@ void wpa_supplicant_deinit(struct wpa_global *global)
|
||||
os_free(global->params.ctrl_interface);
|
||||
|
||||
os_free(global);
|
||||
wpa_debug_close_syslog();
|
||||
wpa_debug_close_file();
|
||||
}
|
||||
|
@ -156,6 +156,11 @@ struct wpa_params {
|
||||
* wpa_debug_file_path - Path of debug file or %NULL to use stdout
|
||||
*/
|
||||
const char *wpa_debug_file_path;
|
||||
|
||||
/**
|
||||
* wpa_debug_syslog - Enable log output through syslog
|
||||
*/
|
||||
const char *wpa_debug_syslog;
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user