Navigation


Changes in / [969:6808de455810:968:652713ce3596] in freeDiameter


Ignore:
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • extensions/acl_wl/aw_conf.l

    r965 r928  
    9696<*>[[:alnum:]]+         |       /* This rule is only useful to print a complete token in error messages */
    9797<*>.                    {
    98                                 TRACE_ERROR("Unrecognized text on line %d col %d: '%s'.\n", yylloc->first_line, yylloc->first_column, yytext);
     98                                TRACE_DEBUG_ERROR("Unrecognized text on line %d col %d: '%s'.\n", yylloc->first_line, yylloc->first_column, yytext);
    9999                                return LEX_ERROR;
    100100                        }
  • extensions/app_radgw/rgw_clients.c

    r965 r740  
    922922        if (TRACE_BOOL(FULL + 1 )) {
    923923                TRACE_DEBUG(FULL, "Adding %s:", (type == RGW_CLI_NAS) ? "NAS" : "PROXY"  );
    924                 TRACE_sSA(FD_LOG_DEBUG, FULL,    "\tIP : ", ip_port, NI_NUMERICHOST | NI_NUMERICSERV, "" );
    925                 TRACE_BUFFER(FD_LOG_DEBUG, FULL, "\tKey: [", *key, keylen, "]" );
     924                TRACE_DEBUG_sSA(FULL,    "\tIP : ", ip_port, NI_NUMERICHOST | NI_NUMERICSERV, "" );
     925                TRACE_DEBUG_BUFFER(FULL, "\tKey: [", *key, keylen, "]" );
    926926        }
    927927       
     
    948948                }
    949949               
    950                 fd_log_erre("ERROR: Conflicting RADIUS clients descriptions!\n");
    951                 TRACE_ERROR("Previous entry: %s", (prev->type == RGW_CLI_NAS) ? "NAS" : "PROXY");
    952                 TRACE_sSA(FD_LOG_ERROR, NONE,    "\tIP : ", prev->sa, NI_NUMERICHOST | NI_NUMERICSERV, "" );
    953                 TRACE_BUFFER(FD_LOG_ERROR, NONE, "\tKey: [", prev->key.data, prev->key.len, "]" );
    954                 TRACE_ERROR("Conflicting entry: %s", (type == RGW_CLI_NAS) ? "NAS" : "PROXY");
    955                 TRACE_sSA(FD_LOG_ERROR, NONE,    "\tIP : ", ip_port, NI_NUMERICHOST | NI_NUMERICSERV, "" );
    956                 TRACE_BUFFER(FD_LOG_ERROR, NONE, "\tKey: [", *key, keylen, "]" );
     950                fd_log_debug("ERROR: Conflicting RADIUS clients descriptions!\n");
     951                TRACE_DEBUG(NONE, "Previous entry: %s", (prev->type == RGW_CLI_NAS) ? "NAS" : "PROXY");
     952                TRACE_DEBUG_sSA(NONE,    "\tIP : ", prev->sa, NI_NUMERICHOST | NI_NUMERICSERV, "" );
     953                TRACE_DEBUG_BUFFER(NONE, "\tKey: [", prev->key.data, prev->key.len, "]" );
     954                TRACE_DEBUG(NONE, "Conflicting entry: %s", (type == RGW_CLI_NAS) ? "NAS" : "PROXY");
     955                TRACE_DEBUG_sSA(NONE,    "\tIP : ", ip_port, NI_NUMERICHOST | NI_NUMERICSERV, "" );
     956                TRACE_DEBUG_BUFFER(NONE, "\tKey: [", *key, keylen, "]" );
    957957        }
    958958end:
     
    970970        for (ref = senti->next; ref != senti; ref = ref->next) {
    971971                client = (struct rgw_client *)ref;
    972                 /* TODO: use a fct param instead of hardcoded FD_LOG_DEBUG */
    973                 TRACE_sSA(FD_LOG_DEBUG, NONE,    "  - ", client->sa, NI_NUMERICHOST | NI_NUMERICSERV, (client->type == RGW_CLI_NAS) ? "" : " [PROXY]" );
     972                TRACE_DEBUG_sSA(NONE,    "  - ", client->sa, NI_NUMERICHOST | NI_NUMERICSERV, (client->type == RGW_CLI_NAS) ? "" : " [PROXY]" );
    974973        }
    975974}
  • extensions/app_radgw/rgw_servers.c

    r965 r740  
    134134               
    135135                TRACE_DEBUG(FULL, "Received %d bytes", len);
    136                 TRACE_sSA(FD_LOG_DEBUG, FULL, " from ", &from, NI_NUMERICHOST | NI_NUMERICSERV, "" );
     136                TRACE_DEBUG_sSA(FULL, " from ", &from, NI_NUMERICHOST | NI_NUMERICSERV, "" );
    137137               
    138138                /* Search the associated client definition, if any */
    139139                CHECK_FCT_DO( rgw_clients_search((struct sockaddr *) &from, &nas_info),
    140140                        {
    141                                 TRACE_NOTICE("Discarding %d bytes received from unknown IP:", len);
    142                                 TRACE_sSA(FD_LOG_NOTICE, INFO, " ", &from, NI_NUMERICHOST | NI_NUMERICSERV, "" );
     141                                TRACE_DEBUG(INFO, "Discarding %d bytes received from unknown IP:", len);
     142                                TRACE_DEBUG_sSA(INFO, " ", &from, NI_NUMERICHOST | NI_NUMERICSERV, "" );
    143143                                continue;
    144144                        } );
     
    274274       
    275275        TRACE_DEBUG(FULL, "Sending %d bytes", buflen);
    276         TRACE_sSA(FD_LOG_DEBUG, FULL, " to ", &sto, NI_NUMERICHOST | NI_NUMERICSERV, "" );
     276        TRACE_DEBUG_sSA(FULL, " to ", &sto, NI_NUMERICHOST | NI_NUMERICSERV, "" );
    277277               
    278278        /* Send */
  • extensions/app_radgw/rgwx_acct.c

    r965 r740  
    435435                if (memcmp(&save[0], &rad_req->hdr->authenticator[0], MD5_MAC_LEN)) {
    436436                        /* Invalid authenticator */
    437                         TRACE_BUFFER(FD_LOG_DEBUG, FULL+1, "Received ReqAuth: ", &save[0], MD5_MAC_LEN, "" );
    438                         TRACE_BUFFER(FD_LOG_DEBUG, FULL+1, "Expected ReqAuth: ", &rad_req->hdr->authenticator[0], MD5_MAC_LEN, "" );
     437                        TRACE_DEBUG_BUFFER(FULL+1, "Received ReqAuth: ", &save[0], MD5_MAC_LEN, "" );
     438                        TRACE_DEBUG_BUFFER(FULL+1, "Expected ReqAuth: ", &rad_req->hdr->authenticator[0], MD5_MAC_LEN, "" );
    439439                        TRACE_DEBUG(INFO, "[acct.rgwx] Invalid Request Authenticator in Account-Request from %s, discarding the message.", rgw_clients_id(cli));
    440440                        return EINVAL;
  • include/freeDiameter/libfdproto.h

    r965 r961  
    112112 * FUNCTION:    fd_log
    113113 * MACRO:       fd_log_debug
    114  * MACRO:       fd_log_notice
    115  * MACRO:       fd_log_error
    116114 *
    117115 * PARAMETERS:
     
    129127 */
    130128void fd_log ( int, const char *, ... );
    131 #define fd_log_debug(format,args...)  fd_log(FD_LOG_DEBUG, format, ## args)
    132 #define fd_log_notice(format,args...) fd_log(FD_LOG_NOTICE, format, ## args)
    133 #define fd_log_error(format,args...)  fd_log(FD_LOG_ERROR, format, ## args)
    134 
     129#define fd_log_debug(format,args...) fd_log(FD_LOG_DEBUG, format, ## args)
    135130void fd_log_debug_fstr( FILE *, const char *, ... );
    136131
     
    216211
    217212/* log levels definitions */
    218 #define FD_LOG_DEBUG  0  /* Verbose information for developers use */
    219 #define FD_LOG_NOTICE 3  /* Normal execution states worth noting */
    220 #define FD_LOG_ERROR  5  /* Error conditions, both recoverable or not */
     213#define FD_LOG_DEBUG 0
     214#define FD_LOG_ERROR 5
    221215
    222216/* print level definitions */
     
    258252
    259253
    260 #define STD_TRACE_FMT_STRING "pid:%s in %s@%s:%d: "
     254#define STD_TRACE_FMT_STRING "thread %s in %s@%s:%d: "
    261255/*************
    262256 The general debug macro, each call results in two lines of debug messages (change the macro for more compact output)
     
    264258#ifdef DEBUG
    265259/* In DEBUG mode, we add (a lot of) meta-information along each trace. This makes multi-threading problems easier to debug. */
    266 #define TRACE(printlevel,level,format,args... ) {                                                                               \
     260#define TRACE_DEBUG(level,format,args... ) {                                                                                    \
    267261        if ( TRACE_BOOL(level) ) {                                                                                              \
    268262                const char * __thn = ((char *)pthread_getspecific(fd_log_thname) ?: "unnamed");                                 \
    269                 fd_log((printlevel), STD_TRACE_FMT_STRING format,                                                               \
    270                                         __thn, __PRETTY_FUNCTION__, __STRIPPED_FILE__, __LINE__, ## args);                      \
     263                fd_log(level, STD_TRACE_FMT_STRING format, \
     264                                        __thn, __PRETTY_FUNCTION__, __FILE__, __LINE__, ## args);                                               \
    271265        }                                                                                                                       \
    272266}
    273267#else /* DEBUG */
    274 /* Do not print thread, function, ... only the message itself in this case */
    275 #define TRACE(printlevel,level,format,args... ) {                                       \
    276         if ( TRACE_BOOL(level) ) {                                                      \
    277                 fd_log((printlevel), format, ## args);                                  \
    278         }                                                                               \
     268/* Do not print thread, function, ... only the message itself in this case, unless the debug level is set > FULL. */
     269#define TRACE_DEBUG(level,format,args... ) {                                                                                            \
     270        if ( TRACE_BOOL(level) ) {                                                                                                      \
     271                if (fd_g_debug_lvl > FULL) {                                                                                            \
     272                        const char * __thn = ((char *)pthread_getspecific(fd_log_thname) ?: "unnamed");                                 \
     273                        fd_log(level, STD_TRACE_FMT_STRING format,      \
     274                               __thn, __PRETTY_FUNCTION__, __FILE__, __LINE__, ## args);  \
     275                } else {                                                                                                                \
     276                        fd_log(level, format, ## args);           \
     277                }                                                                                                                       \
     278        }                                                                                                                               \
    279279}
    280280#endif /* DEBUG */
    281281
    282 /* Report debug information */
    283 #define TRACE_DEBUG(level,format,args... ) \
    284         TRACE(FD_LOG_DEBUG,(level),format,##args)
    285 
    286 /* Report a normal message that is usefull for normal admin monitoring */
    287 #define TRACE_NOTICE(format,args... ) \
    288         TRACE(FD_LOG_NOTICE,INFO,format,##args)
    289 
    290 /* Report an error */
    291 #define TRACE_ERROR(format,args... ) \
    292         TRACE(FD_LOG_ERROR, NONE, format, ##args)
    293 
    294 /*
    295 TRACE_NOTICE(...) and fd_log_notice(...) are equivalent when the code is not compiled in DEBUG mode,
    296 but there is more contextual information when compiled in DEBUG with the TRACE_NOTICE macro,
    297 hence it is recommended to use this one except for formatted output (e.g. fd_*_dump function)
    298 
    299 resp. TRACE_DEBUG and TRACE_ERROR.
    300 */
    301 
    302282/*************
    303  Derivatives for debug
     283 Derivatives from this macro
    304284 ************/
    305285/* Helper for function entry -- for very detailed trace of the execution */
     
    326306
    327307/* Trace a binary buffer content */
    328 #ifdef DEBUG
    329 /* In DEBUG mode, we add (a lot of) meta-information along each trace. This makes multi-threading problems easier to debug. */
    330 #define TRACE_BUFFER(printlevel, level, prefix, buf, bufsz, suffix ) {                                                          \
     308#define TRACE_DEBUG_BUFFER(level, prefix, buf, bufsz, suffix ) {                                                                \
    331309        if ( TRACE_BOOL(level) ) {                                                                                              \
    332310                int __i;                                                                                                        \
    333311                size_t __sz = (size_t)(bufsz);                                                                                  \
    334312                uint8_t * __buf = (uint8_t *)(buf);                                                                             \
    335                 char __strbuf[1024+1];                                                                                          \
    336313                char * __thn = ((char *)pthread_getspecific(fd_log_thname) ?: "unnamed");                                       \
    337                 for (__i = 0; (__i < __sz) && (__i<(sizeof(__strbuf)/2)); __i++) {                                              \
    338                         sprintf(__strbuf + (2 * __i), "%2.2hhx", __buf[__i]);                                                   \
     314                fd_log(level, STD_TRACE_FMT_STRING prefix,              \
     315                       __thn, __PRETTY_FUNCTION__, __FILE__, __LINE__); \
     316                for (__i = 0; __i < __sz; __i++) {                                                                              \
     317                        fd_log(level, "%02.2hhx", __buf[__i]);         \
    339318                }                                                                                                               \
    340                 fd_log(printlevel, STD_TRACE_FMT_STRING "%s%s%s",                                                               \
    341                        __thn, __PRETTY_FUNCTION__, __STRIPPED_FILE__, __LINE__, (prefix), __strbuf, (suffix));                  \
     319                fd_log(level, suffix);                        \
    342320        }                                                                                                                       \
    343321}
    344 #else /* DEBUG */
    345 /* Do not print thread, function, ... only the message itself in this case */
    346 #define TRACE_BUFFER(printlevel, level, prefix, buf, bufsz, suffix ) {                                                          \
    347         if ( TRACE_BOOL(level) ) {                                                                                              \
    348                 int __i;                                                                                                        \
    349                 size_t __sz = (size_t)(bufsz);                                                                                  \
    350                 uint8_t * __buf = (uint8_t *)(buf);                                                                             \
    351                 char __strbuf[1024+1];                                                                                          \
    352                 for (__i = 0; (__i < __sz) && (__i<(sizeof(__strbuf)/2)); __i++) {                                              \
    353                         sprintf(__strbuf + (2 * __i), "%2.2hhx", __buf[__i]);                                                   \
    354                 }                                                                                                               \
    355                 fd_log(printlevel, "%s%s%s", (prefix), __strbuf, (suffix));                                                     \
    356         }                                                                                                                       \
    357 }
    358 #endif /* DEBUG */
    359322
    360323/* Some aliases to socket addresses structures */
     
    371334
    372335/* Dump one sockaddr Node information */
    373 #define sSA_DUMP_NODE( buf, bufsize, sa, flag ) {                       \
    374         sSA * __sa = (sSA *)(sa);                                       \
    375         char __addrbuf[INET6_ADDRSTRLEN];                               \
    376         if (__sa) {                                                     \
    377           int __rc = getnameinfo(__sa,                                  \
    378                         sSAlen(__sa),                                   \
    379                         __addrbuf,                                      \
    380                         sizeof(__addrbuf),                              \
    381                         NULL,                                           \
    382                         0,                                              \
    383                         (flag));                                        \
    384           if (__rc)                                                     \
     336#define sSA_DUMP_NODE( buf, bufsize, sa, flag ) {                \
     337        sSA * __sa = (sSA *)(sa);                               \
     338        char __addrbuf[INET6_ADDRSTRLEN];                       \
     339        if (__sa) {                                             \
     340          int __rc = getnameinfo(__sa,                          \
     341                        sSAlen(__sa),                           \
     342                        __addrbuf,                              \
     343                        sizeof(__addrbuf),                      \
     344                        NULL,                                   \
     345                        0,                                      \
     346                        flag);                                  \
     347          if (__rc)                                             \
    385348                snprintf(buf, bufsize, "%s", gai_strerror(__rc));       \
    386           else                                                          \
    387                 snprintf(buf, bufsize, "%s", &__addrbuf[0]);            \
    388         } else {                                                        \
    389                 snprintf(buf, bufsize, "(NULL / ANY)");                 \
    390         }                                                               \
     349          else                                                  \
     350                snprintf(buf, bufsize, "%s", &__addrbuf[0]);       \
     351        } else {                                                \
     352                snprintf(buf, bufsize, "(NULL / ANY)");             \
     353        }                                                       \
    391354}
    392355/* Same but with the port (service) also */
     
    402365                        __servbuf,                                      \
    403366                        sizeof(__servbuf),                              \
    404                         (flag));                                        \
     367                        flag);                                          \
    405368          if (__rc)                                                     \
    406369                snprintf(buf, bufsize, "%s", gai_strerror(__rc));  \
     
    412375}
    413376
    414 #ifdef DEBUG
    415 /* In DEBUG mode, we add (a lot of) meta-information along each trace. This makes multi-threading problems easier to debug. */
    416 #define TRACE_sSA(printlevel, level, prefix, sa, flags, suffix ) {                                                                              \
     377/* Inside a debug trace */
     378#define TRACE_DEBUG_sSA(level, prefix, sa, flags, suffix ) {                                                                            \
    417379        if ( TRACE_BOOL(level) ) {                                                                                              \
    418                 char __buf[1024];                                                                                               \
     380                char buf[1024]; \
    419381                char * __thn = ((char *)pthread_getspecific(fd_log_thname) ?: "unnamed");                                       \
    420                 sSA_DUMP_NODE_SERV(__buf, sizeof(__buf), sa, flags );                                                           \
    421                 fd_log(printlevel, STD_TRACE_FMT_STRING "%s%s%s" ,                                                              \
    422                        __thn, __PRETTY_FUNCTION__, __STRIPPED_FILE__, __LINE__, (prefix), __buf, (suffix));                     \
     382                sSA_DUMP_NODE_SERV(buf, sizeof(buf), sa, flags );       \
     383                fd_log(level, STD_TRACE_FMT_STRING "%s%s%s",              \
     384                       __thn, __PRETTY_FUNCTION__, __FILE__, __LINE__, prefix, buf, suffix); \
    423385        }                                                                                                                       \
    424386}
    425 #else /* DEBUG */
    426 /* Do not print thread, function, ... only the message itself in this case */
    427 #define TRACE_sSA(printlevel, level, prefix, sa, flags, suffix ) {                                                                              \
    428         if ( TRACE_BOOL(level) ) {                                                                                              \
    429                 char __buf[1024];                                                                                               \
    430                 sSA_DUMP_NODE_SERV(__buf, sizeof(__buf), sa, flags );                                                           \
    431                 fd_log(printlevel, "%s%s%s" , (prefix), __buf, (suffix));                                                       \
    432         }                                                                                                                       \
    433 }
    434 #endif /* DEBUG */
     387
     388/* Report an error */
     389#define TRACE_DEBUG_ERROR(format,args... ) \
     390        TRACE_DEBUG(INFO, format, ##args)
    435391
    436392/******************
     
    439395#ifdef STRIP_DEBUG_CODE
    440396#undef TRACE_DEBUG
    441 #undef TRACE_NOTICE
    442 #undef TRACE_ERROR
    443397#undef TRACE_BOOL
    444 #undef TRACE_BUFFER
    445 #undef TRACE_sSA
    446 
    447 #define TRACE_DEBUG(level,format,args... ) /* noop */
    448 #define TRACE_BOOL(_level_) (0) /* always false */
    449 #define TRACE_NOTICE fd_log_notice
    450 #define TRACE_ERROR fd_log_error
    451 #define TRACE_BUFFER(printlevel, level, prefix, buf, bufsz, suffix ) {                                                          \
    452         if (printlevel > FD_LOG_DEBUG) {                                                                                        \
    453                 int __i;                                                                                                        \
    454                 size_t __sz = (size_t)(bufsz);                                                                                  \
    455                 uint8_t * __buf = (uint8_t *)(buf);                                                                             \
    456                 char * __strbuf[1024+1];                                                                                        \
    457                 for (__i = 0; (__i < __sz) && (__i<(sizeof(__strbuf)/2); __i++) {                                               \
    458                         sprintf(__strbuf + (2 * __i), "%02.2hhx", __buf[__i]);                                                  \
    459                 }                                                                                                               \
    460                 fd_log(printlevel, prefix"%s"suffix, __strbuf);                                                                 \
    461         }
    462 #define TRACE_sSA(printlevel, level, prefix, sa, flags, suffix )  {                                                             \
    463         if (printlevel > FD_LOG_DEBUG) {                                                                                        \
    464                 char __buf[1024];                                                                                               \
    465                 sSA_DUMP_NODE_SERV(__buf, sizeof(__buf), sa, flags );                                                           \
    466                 fd_log(printlevel, prefix "%s" suffix, __buf);                                                                  \
    467         }
     398#undef TRACE_DEBUG_sSA
     399#undef TRACE_DEBUG_BUFFER
     400#undef TRACE_DEBUG_ERROR
     401#define TRACE_DEBUG(level,format,args... )
     402#define TRACE_BOOL(_level_) (0)
     403#define TRACE_DEBUG_BUFFER(level, prefix, buf, bufsz, suffix )
     404#define TRACE_DEBUG_sSA(level, prefix, sa, flags, suffix )
     405#define TRACE_DEBUG_ERROR(format,args... ) {    \
     406        fd_log(FD_LOG_ERROR, format, ## args);  \
     407}
    468408#endif /* STRIP_DEBUG_CODE */
    469409
     
    484424        if (__ret__ < 0) {                                                              \
    485425                int __err__ = errno;    /* We may handle EINTR here */                  \
    486                 TRACE_ERROR("ERROR: in '" #__call__ "' :\t%s", strerror(__err__));\
     426                TRACE_DEBUG_ERROR("ERROR: in '" #__call__ "' :\t%s", strerror(__err__));\
    487427                __fallback__;                                                           \
    488428        }                                                                               \
     
    495435        if (__ret__ < 0) {                                                              \
    496436                int __err__ = errno;    /* We may handle EINTR here */                  \
    497                 TRACE_ERROR("ERROR: in '" #__call__ "' :\t%s", strerror(__err__));\
     437                TRACE_DEBUG_ERROR("ERROR: in '" #__call__ "' :\t%s", strerror(__err__));\
    498438                return __err__;                                                         \
    499439        }                                                                               \
     
    509449                        __fallback1__;                                                          \
    510450                } else {                                                                        \
    511                         TRACE_ERROR("ERROR: in '" #__call__ "':\t%s", strerror(__ret__));       \
     451                        TRACE_DEBUG_ERROR("ERROR: in '" #__call__ "':\t%s", strerror(__ret__)); \
    512452                        __fallback2__;                                                          \
    513453                }                                                                               \
     
    532472        if (__ret__ == NULL) {                                                          \
    533473                int __err__ = errno;                                                    \
    534                 TRACE_ERROR("ERROR: in '" #__call__ "':\t%s", strerror(__err__));       \
     474                TRACE_DEBUG_ERROR("ERROR: in '" #__call__ "':\t%s", strerror(__err__)); \
    535475                __fallback__;                                                           \
    536476        }                                                                               \
     
    546486        TRACE_DEBUG_ALL( "Check PARAMS: " #__bool__ );                                          \
    547487        if ( ! (__bool__) ) {                                                                   \
    548                 TRACE_ERROR("Warning: Invalid parameter received in '" #__bool__ "'");  \
     488                TRACE_DEBUG_ERROR("Warning: Invalid parameter received in '" #__bool__ "'");    \
    549489                __fallback__;                                                                   \
    550490        }
     
    559499        __ret__ = (__call__);                                                           \
    560500        if (__ret__ != 0) {                                                             \
    561                 TRACE_ERROR("ERROR: in '" #__call__ "':\t%s", strerror(__ret__));       \
     501                TRACE_DEBUG_ERROR("ERROR: in '" #__call__ "':\t%s", strerror(__ret__)); \
    562502                __fallback__;                                                           \
    563503        }                                                                               \
  • libfdcore/config.c

    r965 r947  
    248248        if (fddin == NULL) {
    249249                int ret = errno;
    250                 TRACE_ERROR("Unable to open configuration file for reading; tried the following locations: %s%s%s; Error: %s\n",
     250                TRACE_DEBUG_ERROR("Unable to open configuration file for reading; tried the following locations: %s%s%s; Error: %s\n",
    251251                                  orig ?: "", orig? " and " : "", fd_g_config->cnf_file, strerror(ret));
    252252                return ret;
  • libfdcore/fdd.l

    r969 r968  
    8484int globerrfct(const char *epath, int eerrno)
    8585{
    86         TRACE_ERROR("Failed to scan %s: %s\n", epath, strerror(eerrno));
     86        TRACE_DEBUG_ERROR("Failed to scan %s: %s\n", epath, strerror(eerrno));
    8787        return 1;
    8888}
     
    119119                        if (buf[yyleng-2] != '"')
    120120                        {
    121                                 TRACE_ERROR("Unterminated string: %s\n", yytext);
     121                                TRACE_DEBUG_ERROR("Unterminated string: %s\n", yytext);
    122122                                return LEX_ERROR;
    123123                        }
     
    126126                        if (current_nested_level >= MAX_NESTED_CONF_FILES)
    127127                        {
    128                                 TRACE_ERROR("Too many recursion levels in configuration files includes\n");
     128                                TRACE_DEBUG_ERROR("Too many recursion levels in configuration files includes\n");
    129129                                return LEX_ERROR;
    130130                        }
     
    135135                        if (globerror == GLOB_NOSPACE)
    136136                        {
    137                                 TRACE_ERROR("Not enough memory to parse include directive.\n");
     137                                TRACE_DEBUG_ERROR("Not enough memory to parse include directive.\n");
    138138                                return LEX_ERROR;
    139139                        }
    140140                        if (globerror == GLOB_ABORTED)
    141141                        {
    142                                 TRACE_ERROR("An error was encountered in include directive.\n");
     142                                TRACE_DEBUG_ERROR("An error was encountered in include directive.\n");
    143143                                return LEX_ERROR;
    144144                        }
     
    150150                        if (globerror)
    151151                        {
    152                                 TRACE_ERROR("Unexpected error in glob (%d).\n", globerror);
     152                                TRACE_DEBUG_ERROR("Unexpected error in glob (%d).\n", globerror);
    153153                                return LEX_ERROR;
    154154                        }
     
    166166                        if ( ! yyin )
    167167                        {
    168                                 TRACE_ERROR("Error in %s: %s", nested_conffiles[current_nested_level].filelist.gl_pathv[0], strerror(errno));
     168                                TRACE_DEBUG_ERROR("Error in %s: %s", nested_conffiles[current_nested_level].filelist.gl_pathv[0], strerror(errno));
    169169                                return LEX_ERROR;
    170170                        }
     
    206206                                if ( ! yyin )
    207207                                {
    208                                         TRACE_ERROR("Error in %s: %s", nested_conffiles[current_nested_level].filelist.gl_pathv[nested_conffiles[current_nested_level].current_file], strerror(errno));
     208                                        TRACE_DEBUG_ERROR("Error in %s: %s", nested_conffiles[current_nested_level].filelist.gl_pathv[nested_conffiles[current_nested_level].current_file], strerror(errno));
    209209                                        return LEX_ERROR;
    210210                                }
     
    234234                                if (ret != 1) {
    235235                                        /* No matching: an error occurred */
    236                                         TRACE_ERROR("Unable to convert the value '%s' to a valid number: %s\n", yytext, strerror(errno));
     236                                        TRACE_DEBUG_ERROR("Unable to convert the value '%s' to a valid number: %s\n", yytext, strerror(errno));
    237237                                        return LEX_ERROR; /* trig an error in yacc parser */
    238238                                        /* Maybe we could REJECT instead of failing here? */
     
    277277        /* Unrecognized character */
    278278<*>.                    {
    279                                 TRACE_ERROR("Unrecognized text on line %d col %d: '%s'.\n", yylloc->first_line, yylloc->first_column, yytext);
     279                                TRACE_DEBUG_ERROR("Unrecognized text on line %d col %d: '%s'.\n", yylloc->first_line, yylloc->first_column, yytext);
    280280                                return LEX_ERROR;
    281281                        }
  • libfdcore/fdd.y

    r969 r967  
    6363{
    6464        if (ploc->first_line != ploc->last_line) {
    65                 TRACE_ERROR("%s:%d.%d-%d.%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, ploc->last_line, ploc->last_column, s);
     65                TRACE_DEBUG_ERROR("%s:%d.%d-%d.%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, ploc->last_line, ploc->last_column, s);
    6666        } else if (ploc->first_column != ploc->last_column) {
    67                 TRACE_ERROR("%s:%d.%d-%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, ploc->last_column, s);
     67                TRACE_DEBUG_ERROR("%s:%d.%d-%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, ploc->last_column, s);
    6868        } else {
    69                 TRACE_ERROR("%s:%d.%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, s);
     69                TRACE_DEBUG_ERROR("%s:%d.%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, s);
    7070        }
    7171}
     
    504504                                if (fd == NULL) {
    505505                                        int ret = errno;
    506                                         TRACE_ERROR("Unable to open certificate file %s for reading: %s\n", $3, strerror(ret));
     506                                        TRACE_DEBUG_ERROR("Unable to open certificate file %s for reading: %s\n", $3, strerror(ret));
    507507                                        yyerror (&yylloc, conf, "Error on file name");
    508508                                        YYERROR;
     
    512512                                if (fd == NULL) {
    513513                                        int ret = errno;
    514                                         TRACE_ERROR("Unable to open private key file %s for reading: %s\n", $5, strerror(ret));
     514                                        TRACE_DEBUG_ERROR("Unable to open private key file %s for reading: %s\n", $5, strerror(ret));
    515515                                        yyerror (&yylloc, conf, "Error on file name");
    516516                                        YYERROR;
     
    535535                                if (fd == NULL) {
    536536                                        int ret = errno;
    537                                         TRACE_ERROR("Unable to open CA file %s for reading: %s\n", $3, strerror(ret));
     537                                        TRACE_DEBUG_ERROR("Unable to open CA file %s for reading: %s\n", $3, strerror(ret));
    538538                                        yyerror (&yylloc, conf, "Error on file name");
    539539                                        YYERROR;
     
    575575                                if (fd == NULL) {
    576576                                        int ret = errno;
    577                                         TRACE_ERROR("Unable to open CRL file %s for reading: %s\n", $3, strerror(ret));
     577                                        TRACE_DEBUG_ERROR("Unable to open CRL file %s for reading: %s\n", $3, strerror(ret));
    578578                                        yyerror (&yylloc, conf, "Error on file name");
    579579                                        YYERROR;
     
    618618                                                        &err_pos),
    619619                                                { yyerror (&yylloc, conf, "Error setting Priority parameter.");
    620                                                   TRACE_ERROR("Error at position : %s\n", err_pos);
     620                                                  TRACE_DEBUG_ERROR("Error at position : %s\n", err_pos);
    621621                                                  YYERROR; } );
    622622                        }
     
    635635                                if (fd == NULL) {
    636636                                        int ret = errno;
    637                                         TRACE_ERROR("Unable to open DH file %s for reading: %s\n", $3, strerror(ret));
     637                                        TRACE_DEBUG_ERROR("Unable to open DH file %s for reading: %s\n", $3, strerror(ret));
    638638                                        yyerror (&yylloc, conf, "Error on file name");
    639639                                        YYERROR;
  • libfdcore/sctp.c

    r965 r961  
    748748                        fd_log_debug("Calling sctp_bindx with the following address array:\n");
    749749                        for (i = 0; i < count; i++) {
    750                                 TRACE_sSA(FD_LOG_DEBUG, FULL, "    - ", ptr.sa, NI_NUMERICHOST | NI_NUMERICSERV, "" );
     750                                TRACE_DEBUG_sSA(FULL, "    - ", ptr.sa, NI_NUMERICHOST | NI_NUMERICSERV, "" );
    751751                                ptr.buf += (ptr.sa->sa_family == AF_INET) ? sizeof(sSA4) : sizeof(sSA6) ;
    752752                        }
     
    776776                fd_log_debug("SCTP server bound on :\n");
    777777                for (ptr.sa = sar; sz-- > 0; ptr.buf += (ptr.sa->sa_family == AF_INET) ? sizeof(sSA4) : sizeof(sSA6)) {
    778                         TRACE_sSA(FD_LOG_DEBUG, FULL, "    - ", ptr.sa, NI_NUMERICHOST | NI_NUMERICSERV, "" );
     778                        TRACE_DEBUG_sSA(FULL, "    - ", ptr.sa, NI_NUMERICHOST | NI_NUMERICSERV, "" );
    779779                }
    780780                sctp_freeladdrs(sar);
     
    842842                ptr.buf = sar.buf;
    843843                for (i=0; i< count; i++) {
    844                         TRACE_sSA(FD_LOG_DEBUG, FULL, "  - ", ptr.sa, NI_NUMERICHOST | NI_NUMERICSERV, "" );
     844                        TRACE_DEBUG_sSA(FULL, "  - ", ptr.sa, NI_NUMERICHOST | NI_NUMERICSERV, "" );
    845845                        ptr.buf += (ptr.sa->sa_family == AF_INET) ? sizeof(sSA4) : sizeof(sSA6);
    846846                }
     
    11511151                        case SCTP_PEER_ADDR_CHANGE:
    11521152                                TRACE_DEBUG(FULL, "Received SCTP_PEER_ADDR_CHANGE notification");
    1153                                 TRACE_sSA(FD_LOG_DEBUG, SCTP_LEVEL, "    intf_change : ", &(notif->sn_paddr_change.spc_aaddr), NI_NUMERICHOST | NI_NUMERICSERV, "" );
     1153                                TRACE_DEBUG_sSA(SCTP_LEVEL, "    intf_change : ", &(notif->sn_paddr_change.spc_aaddr), NI_NUMERICHOST | NI_NUMERICSERV, "" );
    11541154                                TRACE_DEBUG(SCTP_LEVEL, "          state : %d", notif->sn_paddr_change.spc_state);
    11551155                                TRACE_DEBUG(SCTP_LEVEL, "          error : %d", notif->sn_paddr_change.spc_error);
  • libfdcore/sctps.c

    r965 r894  
    343343       
    344344        CHECK_POSIX_DO( pthread_rwlock_wrlock(&sto->lock), return -1 );
    345         TRACE_BUFFER(FD_LOG_DEBUG, GNUTLS_DBG_LEVEL, "Session store [key ", key.data, key.size, "]");
     345        TRACE_DEBUG_BUFFER(GNUTLS_DBG_LEVEL, "Session store [key ", key.data, key.size, "]");
    346346       
    347347        li = find_or_next(sto, key, &match);
     
    352352                if ((data.size != sr->data.size) || memcmp(data.data, sr->data.data, data.size)) {
    353353                        TRACE_DEBUG(INFO, "GnuTLS tried to store a session with same key and different data!");
    354                         TRACE_BUFFER(FD_LOG_DEBUG, INFO, "Session store [key ", key.data, key.size, "]");
    355                         TRACE_BUFFER(FD_LOG_DEBUG, INFO, "  -- old data [", sr->data.data, sr->data.size, "]");
    356                         TRACE_BUFFER(FD_LOG_DEBUG, INFO, "  -- new data [", data.data, data.size, "]");
     354                        TRACE_DEBUG_BUFFER(INFO, "Session store [key ", key.data, key.size, "]");
     355                        TRACE_DEBUG_BUFFER(INFO, "  -- old data [", sr->data.data, sr->data.size, "]");
     356                        TRACE_DEBUG_BUFFER(INFO, "  -- new data [", data.data, data.size, "]");
    357357                       
    358358                        ret = -1;
     
    397397       
    398398        CHECK_POSIX_DO( pthread_rwlock_wrlock(&sto->lock), return -1 );
    399         TRACE_BUFFER(FD_LOG_DEBUG, GNUTLS_DBG_LEVEL, "Session delete [key ", key.data, key.size, "]");
     399        TRACE_DEBUG_BUFFER(GNUTLS_DBG_LEVEL, "Session delete [key ", key.data, key.size, "]");
    400400       
    401401        li = find_or_next(sto, key, &match);
     
    430430
    431431        CHECK_POSIX_DO( pthread_rwlock_rdlock(&sto->lock), return error );
    432         TRACE_BUFFER(FD_LOG_DEBUG, GNUTLS_DBG_LEVEL, "Session fetch [key ", key.data, key.size, "]");
     432        TRACE_DEBUG_BUFFER(GNUTLS_DBG_LEVEL, "Session fetch [key ", key.data, key.size, "]");
    433433       
    434434        li = find_or_next(sto, key, &match);
     
    557557                        size_t   ids = sizeof(id);
    558558                        CHECK_GNUTLS_DO( gnutls_session_get_id(conn->cc_tls_para.session, id, &ids), /* continue */ );
    559                         TRACE_BUFFER(FD_LOG_DEBUG, GNUTLS_DBG_LEVEL, "Master session id: [", id, ids, "]");
     559                        TRACE_DEBUG_BUFFER(GNUTLS_DBG_LEVEL, "Master session id: [", id, ids, "]");
    560560                }
    561561        }
  • libfdcore/tcp.c

    r965 r788  
    137137        pthread_cleanup_push(fd_cleanup_socket, &s);
    138138       
    139         TRACE_sSA(FD_LOG_DEBUG, FULL, "Attempting TCP connection with peer: ", sa, NI_NUMERICHOST | NI_NUMERICSERV, "..." );
     139        TRACE_DEBUG_sSA(FULL, "Attempting TCP connection with peer: ", sa, NI_NUMERICHOST | NI_NUMERICSERV, "..." );
    140140       
    141141        /* Try connecting to the remote address */
  • libfdproto/log.c

    r966 r961  
    4545
    4646static void fd_internal_logger( int, const char *, va_list );
    47 static int use_colors = 0; /* 0: not init, 1: yes, 2: no */
    4847
    4948/* These may be used to pass specific debug requests via the command-line parameters */
     
    9291    char buf[25];
    9392    FILE *fstr = fd_g_debug_fstr ?: stdout;
    94     int local_use_color = 0;
    9593
    9694    /* logging has been decided by macros outside already */
    9795
    9896    /* add timestamp */
    99     fprintf(fstr, "%s  ", fd_log_time(NULL, buf, sizeof(buf)));
    100    
    101     /* Use colors on stdout ? */
    102     if (!use_colors) {
    103         if (isatty(STDOUT_FILENO))
    104                 use_colors = 1;
    105         else
    106                 use_colors = 2;
     97    fprintf(fd_g_debug_fstr, "%s\t", fd_log_time(NULL, buf, sizeof(buf)));
     98    vfprintf(fd_g_debug_fstr, format, ap);
     99    if (format && (format[strlen(format)-1] != '\n')) {
     100        fprintf(fd_g_debug_fstr, "\n");
    107101    }
    108    
    109     /* now, this time log, do we use colors? */
    110     if ((fstr == stdout) && (use_colors == 1))
    111             local_use_color = 1;
    112    
    113     switch(loglevel) {
    114             case FD_LOG_DEBUG:  fprintf(fstr, local_use_color ? "\e[0;37m" : " DBG   "); break;
    115             case FD_LOG_NOTICE: fprintf(fstr, local_use_color ? "\e[1;37m" : "NOTI   "); break;
    116             case FD_LOG_ERROR:  fprintf(fstr, local_use_color ? "\e[0;31m" : "ERROR  "); break;
    117             default:            fprintf(fstr, local_use_color ? "\e[0;31m" : " ???   ");
    118     }
    119     vfprintf(fstr, format, ap);
    120     if (format && (format[strlen(format)-1] != '\n')) {
    121         fprintf(fstr, "\n");
    122     }
    123     if (local_use_color)
    124              fprintf(fstr, "\e[00m");
    125    
    126     fflush(fstr);
     102    fflush(fd_g_debug_fstr);
    127103}
    128104
Note: See TracChangeset for help on using the changeset viewer.