Mercurial > hg > waaad
changeset 354:e8f36f5342d1
Fixed trace display in radius_gw
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Thu, 14 May 2009 16:19:47 +0900 |
parents | 6ca21598562a |
children | b811859f9963 |
files | doc/radius_gw.conf.sample extensions/radius_gw/radius_gw.c extensions/radius_gw/radius_gw.h extensions/radius_gw/radius_gw.l extensions/radius_gw/radius_gw.y extensions/radius_gw/rgw_servers.c |
diffstat | 6 files changed, 46 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/radius_gw.conf.sample Thu May 14 15:58:30 2009 +0900 +++ b/doc/radius_gw.conf.sample Thu May 14 16:19:47 2009 +0900 @@ -87,3 +87,11 @@ # The IPv6 address to which the server is bound, or "disable" # acct_server_ip6 = :: ; + + +########### +# Debug # +########### + +# Increment this value to display debug messages from the extension +# Verbosity = 0 ;
--- a/extensions/radius_gw/radius_gw.c Thu May 14 15:58:30 2009 +0900 +++ b/extensions/radius_gw/radius_gw.c Thu May 14 16:19:47 2009 +0900 @@ -39,24 +39,26 @@ #define DECLARE_API_POINTERS #include "radius_gw_internal.h" +int radius_gw_verbosity = 0; + static int rgw_init(void) { int ret = 0; ret = rgw_servers_init(); if (ret != 0) { - log_error("Error in servers initialization: %s\n", strerror(ret)); + TRACE_DEBUG(INFO, "Error in servers initialization: %s", strerror(ret)); return ret; } ret = rgw_clients_init(); if (ret != 0) { - log_error("Error in clients initialization: %s\n", strerror(ret)); + TRACE_DEBUG(INFO, "Error in clients initialization: %s", strerror(ret)); return ret; } ret = rgw_extensions_init(); if (ret != 0) { - log_error("Error in extensions initialization: %s\n", strerror(ret)); + TRACE_DEBUG(INFO, "Error in extensions initialization: %s", strerror(ret)); return ret; } @@ -79,11 +81,11 @@ return ret; } - log_normal("-------------------------\n"); + TRACE_DEBUG(FULL, "-------------------------"); rgw_servers_dump(); rgw_clients_dump(); rgw_extensions_dump(); - log_normal("-------------------------\n"); + TRACE_DEBUG(FULL, "-------------------------"); return ret;
--- a/extensions/radius_gw/radius_gw.h Thu May 14 15:58:30 2009 +0900 +++ b/extensions/radius_gw/radius_gw.h Thu May 14 16:19:47 2009 +0900 @@ -41,6 +41,7 @@ /* This file extends definitions from the standard waaad API */ #define IN_EXTENSION +#define DEFINE_DEBUG_MACRO radius_gw #include <waaad/waaad.h> @@ -135,6 +136,8 @@ void rgw_list_unlink(struct rgw_list * plist); +/* Verbosity level for debug */ +extern int radius_gw_verbosity;
--- a/extensions/radius_gw/radius_gw.l Thu May 14 15:58:30 2009 +0900 +++ b/extensions/radius_gw/radius_gw.l Thu May 14 16:19:47 2009 +0900 @@ -108,8 +108,11 @@ /* the yacc parser will check the string is valid */ return QSTRING; } + + +(?i:"verbosity") { BEGIN(EXPECT_DECINT); return VERBOSITY; } + - /* Extension section */ (?i:"ext") { BEGIN(IN_EXT); return EXT_PREFIX; }
--- a/extensions/radius_gw/radius_gw.y Thu May 14 15:58:30 2009 +0900 +++ b/extensions/radius_gw/radius_gw.y Thu May 14 16:19:47 2009 +0900 @@ -169,6 +169,7 @@ %token DISABLED %token AUTH %token ACCT +%token VERBOSITY %token EXT_PREFIX %token CLI_PREFIX @@ -191,6 +192,7 @@ /* The grammar definition */ conffile: /* empty grammar is OK */ + | conffile verbosity | conffile extension | conffile clientdef | conffile authserv @@ -210,6 +212,11 @@ } ; /* -------------------------------------- */ +verbosity: VERBOSITY '=' INTEGER ';' + { + radius_gw_verbosity = $3; + } + ; extension: { buf_reinit();
--- a/extensions/radius_gw/rgw_servers.c Thu May 14 15:58:30 2009 +0900 +++ b/extensions/radius_gw/rgw_servers.c Thu May 14 16:19:47 2009 +0900 @@ -59,25 +59,28 @@ { char ipstr[INET6_ADDRSTRLEN]; - log_normal(" auth server:\n"); - log_normal(" disabled..... : %s\n", rgw_servers.auth_serv.disabled ? "TRUE":"false"); - log_normal(" IP disabled.. : %s\n", rgw_servers.auth_serv.ipv4_disabled ? "TRUE":"false"); - log_normal(" IPv6 disabled : %s\n", rgw_servers.auth_serv.ipv6_disabled ? "TRUE":"false"); - log_normal(" port......... : %hu\n", ntohs(rgw_servers.auth_serv.port)); + if ( ! TRACE_BOOL(FULL) ) + return; + + log_debug(" auth server:\n"); + log_debug(" disabled..... : %s\n", rgw_servers.auth_serv.disabled ? "TRUE":"false"); + log_debug(" IP disabled.. : %s\n", rgw_servers.auth_serv.ipv4_disabled ? "TRUE":"false"); + log_debug(" IPv6 disabled : %s\n", rgw_servers.auth_serv.ipv6_disabled ? "TRUE":"false"); + log_debug(" port......... : %hu\n", ntohs(rgw_servers.auth_serv.port)); inet_ntop(AF_INET, &rgw_servers.auth_serv.ipv4_endpoint,ipstr,sizeof(ipstr)); - log_normal(" IP bind...... : %s\n", ipstr); + log_debug(" IP bind...... : %s\n", ipstr); inet_ntop(AF_INET6, &rgw_servers.auth_serv.ipv6_endpoint,ipstr,sizeof(ipstr)); - log_normal(" IPv6 bind.... : %s\n", ipstr); + log_debug(" IPv6 bind.... : %s\n", ipstr); - log_normal(" acct server:\n"); - log_normal(" disabled..... : %s\n", rgw_servers.acct_serv.disabled ? "TRUE":"false"); - log_normal(" IP disabled.. : %s\n", rgw_servers.acct_serv.ipv4_disabled ? "TRUE":"false"); - log_normal(" IPv6 disabled : %s\n", rgw_servers.acct_serv.ipv6_disabled ? "TRUE":"false"); - log_normal(" port......... : %hu\n", ntohs(rgw_servers.acct_serv.port)); + log_debug(" acct server:\n"); + log_debug(" disabled..... : %s\n", rgw_servers.acct_serv.disabled ? "TRUE":"false"); + log_debug(" IP disabled.. : %s\n", rgw_servers.acct_serv.ipv4_disabled ? "TRUE":"false"); + log_debug(" IPv6 disabled : %s\n", rgw_servers.acct_serv.ipv6_disabled ? "TRUE":"false"); + log_debug(" port......... : %hu\n", ntohs(rgw_servers.acct_serv.port)); inet_ntop(AF_INET, &rgw_servers.acct_serv.ipv4_endpoint,ipstr,sizeof(ipstr)); - log_normal(" IP bind...... : %s\n", ipstr); + log_debug(" IP bind...... : %s\n", ipstr); inet_ntop(AF_INET6, &rgw_servers.acct_serv.ipv6_endpoint,ipstr,sizeof(ipstr)); - log_normal(" IPv6 bind.... : %s\n", ipstr); + log_debug(" IPv6 bind.... : %s\n", ipstr); }