Changeset 965:9b37f34c1b1f in freeDiameter
- Timestamp:
- Mar 13, 2013, 1:23:37 AM (11 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/acl_wl/aw_conf.l
r928 r965 96 96 <*>[[:alnum:]]+ | /* This rule is only useful to print a complete token in error messages */ 97 97 <*>. { 98 TRACE_ DEBUG_ERROR("Unrecognized text on line %d col %d: '%s'.\n", yylloc->first_line, yylloc->first_column, yytext);98 TRACE_ERROR("Unrecognized text on line %d col %d: '%s'.\n", yylloc->first_line, yylloc->first_column, yytext); 99 99 return LEX_ERROR; 100 100 } -
extensions/app_radgw/rgw_clients.c
r740 r965 922 922 if (TRACE_BOOL(FULL + 1 )) { 923 923 TRACE_DEBUG(FULL, "Adding %s:", (type == RGW_CLI_NAS) ? "NAS" : "PROXY" ); 924 TRACE_ DEBUG_sSA(FULL, "\tIP : ", ip_port, NI_NUMERICHOST | NI_NUMERICSERV, "" );925 TRACE_ DEBUG_BUFFER(FULL, "\tKey: [", *key, keylen, "]" );924 TRACE_sSA(FD_LOG_DEBUG, FULL, "\tIP : ", ip_port, NI_NUMERICHOST | NI_NUMERICSERV, "" ); 925 TRACE_BUFFER(FD_LOG_DEBUG, FULL, "\tKey: [", *key, keylen, "]" ); 926 926 } 927 927 … … 948 948 } 949 949 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, "]" );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, "]" ); 957 957 } 958 958 end: … … 970 970 for (ref = senti->next; ref != senti; ref = ref->next) { 971 971 client = (struct rgw_client *)ref; 972 TRACE_DEBUG_sSA(NONE, " - ", client->sa, NI_NUMERICHOST | NI_NUMERICSERV, (client->type == RGW_CLI_NAS) ? "" : " [PROXY]" ); 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]" ); 973 974 } 974 975 } -
extensions/app_radgw/rgw_servers.c
r740 r965 134 134 135 135 TRACE_DEBUG(FULL, "Received %d bytes", len); 136 TRACE_ DEBUG_sSA(FULL, " from ", &from, NI_NUMERICHOST | NI_NUMERICSERV, "" );136 TRACE_sSA(FD_LOG_DEBUG, FULL, " from ", &from, NI_NUMERICHOST | NI_NUMERICSERV, "" ); 137 137 138 138 /* Search the associated client definition, if any */ 139 139 CHECK_FCT_DO( rgw_clients_search((struct sockaddr *) &from, &nas_info), 140 140 { 141 TRACE_ DEBUG(INFO,"Discarding %d bytes received from unknown IP:", len);142 TRACE_ DEBUG_sSA(INFO, " ", &from, NI_NUMERICHOST | NI_NUMERICSERV, "" );141 TRACE_NOTICE("Discarding %d bytes received from unknown IP:", len); 142 TRACE_sSA(FD_LOG_NOTICE, INFO, " ", &from, NI_NUMERICHOST | NI_NUMERICSERV, "" ); 143 143 continue; 144 144 } ); … … 274 274 275 275 TRACE_DEBUG(FULL, "Sending %d bytes", buflen); 276 TRACE_ DEBUG_sSA(FULL, " to ", &sto, NI_NUMERICHOST | NI_NUMERICSERV, "" );276 TRACE_sSA(FD_LOG_DEBUG, FULL, " to ", &sto, NI_NUMERICHOST | NI_NUMERICSERV, "" ); 277 277 278 278 /* Send */ -
extensions/app_radgw/rgwx_acct.c
r740 r965 435 435 if (memcmp(&save[0], &rad_req->hdr->authenticator[0], MD5_MAC_LEN)) { 436 436 /* Invalid authenticator */ 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, "" );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, "" ); 439 439 TRACE_DEBUG(INFO, "[acct.rgwx] Invalid Request Authenticator in Account-Request from %s, discarding the message.", rgw_clients_id(cli)); 440 440 return EINVAL; -
include/freeDiameter/libfdproto.h
r961 r965 112 112 * FUNCTION: fd_log 113 113 * MACRO: fd_log_debug 114 * MACRO: fd_log_notice 115 * MACRO: fd_log_error 114 116 * 115 117 * PARAMETERS: … … 127 129 */ 128 130 void fd_log ( int, const char *, ... ); 129 #define fd_log_debug(format,args...) fd_log(FD_LOG_DEBUG, format, ## args) 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 130 135 void fd_log_debug_fstr( FILE *, const char *, ... ); 131 136 … … 211 216 212 217 /* log levels definitions */ 213 #define FD_LOG_DEBUG 0 214 #define FD_LOG_ERROR 5 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 */ 215 221 216 222 /* print level definitions */ … … 252 258 253 259 254 #define STD_TRACE_FMT_STRING " thread%s in %s@%s:%d: "260 #define STD_TRACE_FMT_STRING "pid:%s in %s@%s:%d: " 255 261 /************* 256 262 The general debug macro, each call results in two lines of debug messages (change the macro for more compact output) … … 258 264 #ifdef DEBUG 259 265 /* In DEBUG mode, we add (a lot of) meta-information along each trace. This makes multi-threading problems easier to debug. */ 260 #define TRACE _DEBUG(level,format,args... ) {\266 #define TRACE(printlevel,level,format,args... ) { \ 261 267 if ( TRACE_BOOL(level) ) { \ 262 268 const char * __thn = ((char *)pthread_getspecific(fd_log_thname) ?: "unnamed"); \ 263 fd_log( level, STD_TRACE_FMT_STRING format,\264 __thn, __PRETTY_FUNCTION__, __ FILE__, __LINE__, ## args);\269 fd_log((printlevel), STD_TRACE_FMT_STRING format, \ 270 __thn, __PRETTY_FUNCTION__, __STRIPPED_FILE__, __LINE__, ## args); \ 265 271 } \ 266 272 } 267 273 #else /* DEBUG */ 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 } \ 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 } \ 279 279 } 280 280 #endif /* DEBUG */ 281 281 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 282 302 /************* 283 Derivatives f rom this macro303 Derivatives for debug 284 304 ************/ 285 305 /* Helper for function entry -- for very detailed trace of the execution */ … … 306 326 307 327 /* Trace a binary buffer content */ 308 #define TRACE_DEBUG_BUFFER(level, prefix, buf, bufsz, suffix ) { \ 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 ) { \ 309 331 if ( TRACE_BOOL(level) ) { \ 310 332 int __i; \ 311 333 size_t __sz = (size_t)(bufsz); \ 312 334 uint8_t * __buf = (uint8_t *)(buf); \ 335 char __strbuf[1024+1]; \ 313 336 char * __thn = ((char *)pthread_getspecific(fd_log_thname) ?: "unnamed"); \ 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]); \ 337 for (__i = 0; (__i < __sz) && (__i<(sizeof(__strbuf)/2)); __i++) { \ 338 sprintf(__strbuf + (2 * __i), "%2.2hhx", __buf[__i]); \ 318 339 } \ 319 fd_log(level, suffix); \ 340 fd_log(printlevel, STD_TRACE_FMT_STRING "%s%s%s", \ 341 __thn, __PRETTY_FUNCTION__, __STRIPPED_FILE__, __LINE__, (prefix), __strbuf, (suffix)); \ 320 342 } \ 321 343 } 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 */ 322 359 323 360 /* Some aliases to socket addresses structures */ … … 334 371 335 372 /* Dump one sockaddr Node information */ 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) \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) \ 348 385 snprintf(buf, bufsize, "%s", gai_strerror(__rc)); \ 349 else \350 snprintf(buf, bufsize, "%s", &__addrbuf[0]); \351 } else { \352 snprintf(buf, bufsize, "(NULL / ANY)"); \353 } \386 else \ 387 snprintf(buf, bufsize, "%s", &__addrbuf[0]); \ 388 } else { \ 389 snprintf(buf, bufsize, "(NULL / ANY)"); \ 390 } \ 354 391 } 355 392 /* Same but with the port (service) also */ … … 365 402 __servbuf, \ 366 403 sizeof(__servbuf), \ 367 flag);\404 (flag)); \ 368 405 if (__rc) \ 369 406 snprintf(buf, bufsize, "%s", gai_strerror(__rc)); \ … … 375 412 } 376 413 377 /* Inside a debug trace */ 378 #define TRACE_DEBUG_sSA(level, prefix, sa, flags, suffix ) { \ 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 ) { \ 379 417 if ( TRACE_BOOL(level) ) { \ 380 char buf[1024];\418 char __buf[1024]; \ 381 419 char * __thn = ((char *)pthread_getspecific(fd_log_thname) ?: "unnamed"); \ 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);\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)); \ 385 423 } \ 386 424 } 387 388 /* Report an error */ 389 #define TRACE_DEBUG_ERROR(format,args... ) \ 390 TRACE_DEBUG(INFO, format, ##args) 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 */ 391 435 392 436 /****************** … … 395 439 #ifdef STRIP_DEBUG_CODE 396 440 #undef TRACE_DEBUG 441 #undef TRACE_NOTICE 442 #undef TRACE_ERROR 397 443 #undef TRACE_BOOL 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 } 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 } 408 468 #endif /* STRIP_DEBUG_CODE */ 409 469 … … 424 484 if (__ret__ < 0) { \ 425 485 int __err__ = errno; /* We may handle EINTR here */ \ 426 TRACE_ DEBUG_ERROR("ERROR: in '" #__call__ "' :\t%s", strerror(__err__));\486 TRACE_ERROR("ERROR: in '" #__call__ "' :\t%s", strerror(__err__));\ 427 487 __fallback__; \ 428 488 } \ … … 435 495 if (__ret__ < 0) { \ 436 496 int __err__ = errno; /* We may handle EINTR here */ \ 437 TRACE_ DEBUG_ERROR("ERROR: in '" #__call__ "' :\t%s", strerror(__err__));\497 TRACE_ERROR("ERROR: in '" #__call__ "' :\t%s", strerror(__err__));\ 438 498 return __err__; \ 439 499 } \ … … 449 509 __fallback1__; \ 450 510 } else { \ 451 TRACE_ DEBUG_ERROR("ERROR: in '" #__call__ "':\t%s", strerror(__ret__)); \511 TRACE_ERROR("ERROR: in '" #__call__ "':\t%s", strerror(__ret__)); \ 452 512 __fallback2__; \ 453 513 } \ … … 472 532 if (__ret__ == NULL) { \ 473 533 int __err__ = errno; \ 474 TRACE_ DEBUG_ERROR("ERROR: in '" #__call__ "':\t%s", strerror(__err__)); \534 TRACE_ERROR("ERROR: in '" #__call__ "':\t%s", strerror(__err__)); \ 475 535 __fallback__; \ 476 536 } \ … … 486 546 TRACE_DEBUG_ALL( "Check PARAMS: " #__bool__ ); \ 487 547 if ( ! (__bool__) ) { \ 488 TRACE_ DEBUG_ERROR("Warning: Invalid parameter received in '" #__bool__ "'"); \548 TRACE_ERROR("Warning: Invalid parameter received in '" #__bool__ "'"); \ 489 549 __fallback__; \ 490 550 } … … 499 559 __ret__ = (__call__); \ 500 560 if (__ret__ != 0) { \ 501 TRACE_ DEBUG_ERROR("ERROR: in '" #__call__ "':\t%s", strerror(__ret__)); \561 TRACE_ERROR("ERROR: in '" #__call__ "':\t%s", strerror(__ret__)); \ 502 562 __fallback__; \ 503 563 } \ -
libfdcore/config.c
r947 r965 248 248 if (fddin == NULL) { 249 249 int ret = errno; 250 TRACE_ DEBUG_ERROR("Unable to open configuration file for reading; tried the following locations: %s%s%s; Error: %s\n",250 TRACE_ERROR("Unable to open configuration file for reading; tried the following locations: %s%s%s; Error: %s\n", 251 251 orig ?: "", orig? " and " : "", fd_g_config->cnf_file, strerror(ret)); 252 252 return ret; -
libfdcore/fdd.l
r961 r965 52 52 yylloc->first_column = yylloc->last_column + 1; \ 53 53 yylloc->last_column = yylloc->first_column + yyleng - 1; \ 54 TRACE_ DEBUG_ERROR( \54 TRACE_ERROR( \ 55 55 "(%d:%d-%d:%d) matched rule %d, length=%d, txt='%s'\n", \ 56 56 yylloc->first_line, yylloc->first_column, \ … … 84 84 int globerrfct(const char *epath, int eerrno) 85 85 { 86 TRACE_ DEBUG_ERROR("Failed to scan %s: %s\n", epath, strerror(eerrno));86 TRACE_ERROR("Failed to scan %s: %s\n", epath, strerror(eerrno)); 87 87 return 1; 88 88 } … … 119 119 if (buf[yyleng-2] != '"') 120 120 { 121 TRACE_ DEBUG_ERROR("Unterminated string: %s\n", yytext);121 TRACE_ERROR("Unterminated string: %s\n", yytext); 122 122 return LEX_ERROR; 123 123 } … … 126 126 if (current_nested_level >= MAX_NESTED_CONF_FILES) 127 127 { 128 TRACE_ DEBUG_ERROR("Too many recursion levels in configuration files includes\n");128 TRACE_ERROR("Too many recursion levels in configuration files includes\n"); 129 129 return LEX_ERROR; 130 130 } … … 135 135 if (globerror == GLOB_NOSPACE) 136 136 { 137 TRACE_ DEBUG_ERROR("Not enough memory to parse include directive.\n");137 TRACE_ERROR("Not enough memory to parse include directive.\n"); 138 138 return LEX_ERROR; 139 139 } 140 140 if (globerror == GLOB_ABORTED) 141 141 { 142 TRACE_ DEBUG_ERROR("An error was encountered in include directive.\n");142 TRACE_ERROR("An error was encountered in include directive.\n"); 143 143 return LEX_ERROR; 144 144 } … … 150 150 if (globerror) 151 151 { 152 TRACE_ DEBUG_ERROR("Unexpected error in glob (%d).\n", globerror);152 TRACE_ERROR("Unexpected error in glob (%d).\n", globerror); 153 153 return LEX_ERROR; 154 154 } … … 166 166 if ( ! yyin ) 167 167 { 168 TRACE_ DEBUG_ERROR("Error in %s: %s", nested_conffiles[current_nested_level].filelist.gl_pathv[0], strerror(errno));168 TRACE_ERROR("Error in %s: %s", nested_conffiles[current_nested_level].filelist.gl_pathv[0], strerror(errno)); 169 169 return LEX_ERROR; 170 170 } … … 206 206 if ( ! yyin ) 207 207 { 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));208 TRACE_ERROR("Error in %s: %s", nested_conffiles[current_nested_level].filelist.gl_pathv[nested_conffiles[current_nested_level].current_file], strerror(errno)); 209 209 return LEX_ERROR; 210 210 } … … 234 234 if (ret != 1) { 235 235 /* No matching: an error occurred */ 236 TRACE_ DEBUG_ERROR("Unable to convert the value '%s' to a valid number: %s\n", yytext, strerror(errno));236 TRACE_ERROR("Unable to convert the value '%s' to a valid number: %s\n", yytext, strerror(errno)); 237 237 return LEX_ERROR; /* trig an error in yacc parser */ 238 238 /* Maybe we could REJECT instead of failing here? */ … … 277 277 /* Unrecognized character */ 278 278 <*>. { 279 TRACE_ DEBUG_ERROR("Unrecognized text on line %d col %d: '%s'.\n", yylloc->first_line, yylloc->first_column, yytext);279 TRACE_ERROR("Unrecognized text on line %d col %d: '%s'.\n", yylloc->first_line, yylloc->first_column, yytext); 280 280 return LEX_ERROR; 281 281 } -
libfdcore/fdd.y
r964 r965 63 63 { 64 64 if (ploc->first_line != ploc->last_line) { 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);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); 66 66 } else if (ploc->first_column != ploc->last_column) { 67 TRACE_ DEBUG_ERROR("%s:%d.%d-%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, ploc->last_column, s);67 TRACE_ERROR("%s:%d.%d-%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, ploc->last_column, s); 68 68 } else { 69 TRACE_ DEBUG_ERROR("%s:%d.%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, s);69 TRACE_ERROR("%s:%d.%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, s); 70 70 } 71 71 } … … 328 328 if (fd == NULL) { 329 329 int ret = errno; 330 TRACE_ DEBUG_ERROR("WARNING: Unable to open extension file %s for reading: %s\nLD_LIBRARY_PATH will be used.\n", fname, strerror(ret));330 TRACE_ERROR("WARNING: Unable to open extension file %s for reading: %s\nLD_LIBRARY_PATH will be used.\n", fname, strerror(ret)); 331 331 } else { 332 332 fclose(fd); … … 501 501 if (fd == NULL) { 502 502 int ret = errno; 503 TRACE_ DEBUG_ERROR("Unable to open certificate file %s for reading: %s\n", $3, strerror(ret));503 TRACE_ERROR("Unable to open certificate file %s for reading: %s\n", $3, strerror(ret)); 504 504 yyerror (&yylloc, conf, "Error on file name"); 505 505 YYERROR; … … 509 509 if (fd == NULL) { 510 510 int ret = errno; 511 TRACE_ DEBUG_ERROR("Unable to open private key file %s for reading: %s\n", $5, strerror(ret));511 TRACE_ERROR("Unable to open private key file %s for reading: %s\n", $5, strerror(ret)); 512 512 yyerror (&yylloc, conf, "Error on file name"); 513 513 YYERROR; … … 532 532 if (fd == NULL) { 533 533 int ret = errno; 534 TRACE_ DEBUG_ERROR("Unable to open CA file %s for reading: %s\n", $3, strerror(ret));534 TRACE_ERROR("Unable to open CA file %s for reading: %s\n", $3, strerror(ret)); 535 535 yyerror (&yylloc, conf, "Error on file name"); 536 536 YYERROR; … … 572 572 if (fd == NULL) { 573 573 int ret = errno; 574 TRACE_ DEBUG_ERROR("Unable to open CRL file %s for reading: %s\n", $3, strerror(ret));574 TRACE_ERROR("Unable to open CRL file %s for reading: %s\n", $3, strerror(ret)); 575 575 yyerror (&yylloc, conf, "Error on file name"); 576 576 YYERROR; … … 615 615 &err_pos), 616 616 { yyerror (&yylloc, conf, "Error setting Priority parameter."); 617 TRACE_ DEBUG_ERROR("Error at position : %s\n", err_pos);617 TRACE_ERROR("Error at position : %s\n", err_pos); 618 618 YYERROR; } ); 619 619 } … … 632 632 if (fd == NULL) { 633 633 int ret = errno; 634 TRACE_ DEBUG_ERROR("Unable to open DH file %s for reading: %s\n", $3, strerror(ret));634 TRACE_ERROR("Unable to open DH file %s for reading: %s\n", $3, strerror(ret)); 635 635 yyerror (&yylloc, conf, "Error on file name"); 636 636 YYERROR; -
libfdcore/sctp.c
r961 r965 748 748 fd_log_debug("Calling sctp_bindx with the following address array:\n"); 749 749 for (i = 0; i < count; i++) { 750 TRACE_ DEBUG_sSA(FULL, " - ", ptr.sa, NI_NUMERICHOST | NI_NUMERICSERV, "" );750 TRACE_sSA(FD_LOG_DEBUG, FULL, " - ", ptr.sa, NI_NUMERICHOST | NI_NUMERICSERV, "" ); 751 751 ptr.buf += (ptr.sa->sa_family == AF_INET) ? sizeof(sSA4) : sizeof(sSA6) ; 752 752 } … … 776 776 fd_log_debug("SCTP server bound on :\n"); 777 777 for (ptr.sa = sar; sz-- > 0; ptr.buf += (ptr.sa->sa_family == AF_INET) ? sizeof(sSA4) : sizeof(sSA6)) { 778 TRACE_ DEBUG_sSA(FULL, " - ", ptr.sa, NI_NUMERICHOST | NI_NUMERICSERV, "" );778 TRACE_sSA(FD_LOG_DEBUG, FULL, " - ", ptr.sa, NI_NUMERICHOST | NI_NUMERICSERV, "" ); 779 779 } 780 780 sctp_freeladdrs(sar); … … 842 842 ptr.buf = sar.buf; 843 843 for (i=0; i< count; i++) { 844 TRACE_ DEBUG_sSA(FULL, " - ", ptr.sa, NI_NUMERICHOST | NI_NUMERICSERV, "" );844 TRACE_sSA(FD_LOG_DEBUG, FULL, " - ", ptr.sa, NI_NUMERICHOST | NI_NUMERICSERV, "" ); 845 845 ptr.buf += (ptr.sa->sa_family == AF_INET) ? sizeof(sSA4) : sizeof(sSA6); 846 846 } … … 1151 1151 case SCTP_PEER_ADDR_CHANGE: 1152 1152 TRACE_DEBUG(FULL, "Received SCTP_PEER_ADDR_CHANGE notification"); 1153 TRACE_ DEBUG_sSA(SCTP_LEVEL, " intf_change : ", &(notif->sn_paddr_change.spc_aaddr), NI_NUMERICHOST | NI_NUMERICSERV, "" );1153 TRACE_sSA(FD_LOG_DEBUG, SCTP_LEVEL, " intf_change : ", &(notif->sn_paddr_change.spc_aaddr), NI_NUMERICHOST | NI_NUMERICSERV, "" ); 1154 1154 TRACE_DEBUG(SCTP_LEVEL, " state : %d", notif->sn_paddr_change.spc_state); 1155 1155 TRACE_DEBUG(SCTP_LEVEL, " error : %d", notif->sn_paddr_change.spc_error); -
libfdcore/sctps.c
r894 r965 343 343 344 344 CHECK_POSIX_DO( pthread_rwlock_wrlock(&sto->lock), return -1 ); 345 TRACE_ DEBUG_BUFFER(GNUTLS_DBG_LEVEL, "Session store [key ", key.data, key.size, "]");345 TRACE_BUFFER(FD_LOG_DEBUG, GNUTLS_DBG_LEVEL, "Session store [key ", key.data, key.size, "]"); 346 346 347 347 li = find_or_next(sto, key, &match); … … 352 352 if ((data.size != sr->data.size) || memcmp(data.data, sr->data.data, data.size)) { 353 353 TRACE_DEBUG(INFO, "GnuTLS tried to store a session with same key and different data!"); 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, "]");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, "]"); 357 357 358 358 ret = -1; … … 397 397 398 398 CHECK_POSIX_DO( pthread_rwlock_wrlock(&sto->lock), return -1 ); 399 TRACE_ DEBUG_BUFFER(GNUTLS_DBG_LEVEL, "Session delete [key ", key.data, key.size, "]");399 TRACE_BUFFER(FD_LOG_DEBUG, GNUTLS_DBG_LEVEL, "Session delete [key ", key.data, key.size, "]"); 400 400 401 401 li = find_or_next(sto, key, &match); … … 430 430 431 431 CHECK_POSIX_DO( pthread_rwlock_rdlock(&sto->lock), return error ); 432 TRACE_ DEBUG_BUFFER(GNUTLS_DBG_LEVEL, "Session fetch [key ", key.data, key.size, "]");432 TRACE_BUFFER(FD_LOG_DEBUG, GNUTLS_DBG_LEVEL, "Session fetch [key ", key.data, key.size, "]"); 433 433 434 434 li = find_or_next(sto, key, &match); … … 557 557 size_t ids = sizeof(id); 558 558 CHECK_GNUTLS_DO( gnutls_session_get_id(conn->cc_tls_para.session, id, &ids), /* continue */ ); 559 TRACE_ DEBUG_BUFFER(GNUTLS_DBG_LEVEL, "Master session id: [", id, ids, "]");559 TRACE_BUFFER(FD_LOG_DEBUG, GNUTLS_DBG_LEVEL, "Master session id: [", id, ids, "]"); 560 560 } 561 561 } -
libfdcore/tcp.c
r788 r965 137 137 pthread_cleanup_push(fd_cleanup_socket, &s); 138 138 139 TRACE_ DEBUG_sSA(FULL, "Attempting TCP connection with peer: ", sa, NI_NUMERICHOST | NI_NUMERICSERV, "..." );139 TRACE_sSA(FD_LOG_DEBUG, FULL, "Attempting TCP connection with peer: ", sa, NI_NUMERICHOST | NI_NUMERICSERV, "..." ); 140 140 141 141 /* Try connecting to the remote address */ -
libfdproto/log.c
r961 r965 95 95 96 96 /* add timestamp */ 97 fprintf(fd_g_debug_fstr, "%s\t", fd_log_time(NULL, buf, sizeof(buf))); 97 fprintf(fd_g_debug_fstr, "%s ", fd_log_time(NULL, buf, sizeof(buf))); 98 switch(loglevel) { 99 case FD_LOG_DEBUG: fprintf(fd_g_debug_fstr, " DBG "); break; 100 case FD_LOG_NOTICE: fprintf(fd_g_debug_fstr, "NOTI "); break; 101 case FD_LOG_ERROR: fprintf(fd_g_debug_fstr, "ERROR "); break; 102 default: fprintf(fd_g_debug_fstr, " ??? "); 103 } 98 104 vfprintf(fd_g_debug_fstr, format, ap); 99 105 if (format && (format[strlen(format)-1] != '\n')) {
Note: See TracChangeset
for help on using the changeset viewer.