# HG changeset patch # User Sebastien Decugis # Date 1368369547 -7200 # Node ID 96f2051215c81e3f815ebd377c1456db404ada46 # Parent 8401adfb58f5671e0e3cbad0a0f4bd63e50b8fa4 Replaced calls to TRACE_sSA and sSA_DUMP_NODE* macros diff -r 8401adfb58f5 -r 96f2051215c8 extensions/app_radgw/rgw_clients.c --- a/extensions/app_radgw/rgw_clients.c Fri May 10 13:26:03 2013 +0200 +++ b/extensions/app_radgw/rgw_clients.c Sun May 12 16:39:07 2013 +0200 @@ -920,8 +920,10 @@ /* Dump the entry in debug mode */ if (TRACE_BOOL(FULL + 1 )) { + char sa_buf[sSA_DUMP_STRLEN]; + fd_sa_sdump_numeric(sa_buf, ip_port); TRACE_DEBUG(FULL, "Adding %s:", (type == RGW_CLI_NAS) ? "NAS" : "PROXY" ); - TRACE_sSA(FD_LOG_DEBUG, FULL, "\tIP : ", ip_port, NI_NUMERICHOST | NI_NUMERICSERV, "" ); + TRACE_DEBUG(FULL, "\tIP : %s", sa_buf ); TRACE_BUFFER(FD_LOG_DEBUG, FULL, "\tKey: [", *key, keylen, "]" ); } @@ -940,6 +942,7 @@ } if (ret == EEXIST) { + char sa_buf[sSA_DUMP_STRLEN]; /* Check if the key is the same, then skip or return an error */ if ((keylen == prev->key.len ) && ( ! memcmp(*key, prev->key.data, keylen) ) && (type == prev->type)) { TRACE_DEBUG(INFO, "Skipping duplicate client description"); @@ -949,10 +952,12 @@ fd_log_error("ERROR: Conflicting RADIUS clients descriptions!"); TRACE_ERROR("Previous entry: %s", (prev->type == RGW_CLI_NAS) ? "NAS" : "PROXY"); - TRACE_sSA(FD_LOG_ERROR, NONE, "\tIP : ", prev->sa, NI_NUMERICHOST | NI_NUMERICSERV, "" ); + fd_sa_sdump_numeric(sa_buf, prev->sa); + TRACE_ERROR("\tIP : %s", sa_buf); TRACE_BUFFER(FD_LOG_ERROR, NONE, "\tKey: [", prev->key.data, prev->key.len, "]" ); TRACE_ERROR("Conflicting entry: %s", (type == RGW_CLI_NAS) ? "NAS" : "PROXY"); - TRACE_sSA(FD_LOG_ERROR, NONE, "\tIP : ", ip_port, NI_NUMERICHOST | NI_NUMERICSERV, "" ); + fd_sa_sdump_numeric(sa_buf, ip_port); + TRACE_ERROR("\tIP : %s", sa_buf); TRACE_BUFFER(FD_LOG_ERROR, NONE, "\tKey: [", *key, keylen, "]" ); } end: @@ -968,9 +973,11 @@ struct fd_list *ref = NULL; for (ref = senti->next; ref != senti; ref = ref->next) { + char sa_buf[sSA_DUMP_STRLEN]; client = (struct rgw_client *)ref; /* TODO: use a fct param instead of hardcoded FD_LOG_DEBUG */ - TRACE_sSA(FD_LOG_DEBUG, NONE, " - ", client->sa, NI_NUMERICHOST | NI_NUMERICSERV, (client->type == RGW_CLI_NAS) ? "" : " [PROXY]" ); + TODO("Replace with appropriate code"); +/* TRACE_sSA(FD_LOG_DEBUG, NONE, " - ", client->sa, NI_NUMERICHOST | NI_NUMERICSERV, (client->type == RGW_CLI_NAS) ? "" : " [PROXY]" ); */ } } diff -r 8401adfb58f5 -r 96f2051215c8 extensions/app_radgw/rgw_servers.c --- a/extensions/app_radgw/rgw_servers.c Fri May 10 13:26:03 2013 +0200 +++ b/extensions/app_radgw/rgw_servers.c Sun May 12 16:39:07 2013 +0200 @@ -110,6 +110,7 @@ /* Now loop on this socket, parse and queue each message received, until thread is cancelled. */ while (1) { struct sockaddr_storage from; + char sa_buf[sSA_DUMP_STRLEN]; socklen_t fromlen = sizeof(from); int len; struct rgw_client * nas_info = NULL; @@ -132,17 +133,13 @@ continue; } - { - char __buf[1024]; - sSA_DUMP_NODE_SERV(__buf, sizeof(__buf), &from, NI_NUMERICHOST | NI_NUMERICSERV ); - TRACE_DEBUG(FULL, "Received %d bytes from %s", len, __buf); - } + fd_sa_sdump_numeric(sa_buf, (sSA*)&from); + TRACE_DEBUG(FULL, "Received %d bytes from %s", len, sa_buf); /* Search the associated client definition, if any */ CHECK_FCT_DO( rgw_clients_search((struct sockaddr *) &from, &nas_info), { - TRACE_NOTICE("Discarding %d bytes received from unknown IP:", len); - TRACE_sSA(FD_LOG_NOTICE, INFO, " ", &from, NI_NUMERICHOST | NI_NUMERICSERV, "" ); + TRACE_NOTICE("Discarding %d bytes received from unknown IP: %s", len, sa_buf); continue; } ); @@ -249,6 +246,7 @@ int idx = 0; int ret = 0; struct sockaddr_storage sto; + char sa_buf[sSA_DUMP_STRLEN]; /* Find the appropriate socket to use (not sure if it is important) */ for (idx = 0; idx < sizeof(SERVERS) / sizeof(SERVERS[0]); idx++) { @@ -275,11 +273,8 @@ ((struct sockaddr_in6 *)&sto)->sin6_port = to_port; } - { - char __buf[1024]; - sSA_DUMP_NODE_SERV(__buf, sizeof(__buf), &sto, NI_NUMERICHOST | NI_NUMERICSERV ); - TRACE_DEBUG(FULL, "Sending %zd bytes to %s", buflen, __buf); - } + fd_sa_sdump_numeric(sa_buf, (sSA*)&sto); + TRACE_DEBUG(FULL, "Sending %zd bytes to %s", buflen, sa_buf); /* Send */ ret = sendto(SERVERS[idx].sock, buf, buflen, 0, (struct sockaddr *)&sto, sSAlen(&sto)); diff -r 8401adfb58f5 -r 96f2051215c8 include/freeDiameter/libfdproto.h --- a/include/freeDiameter/libfdproto.h Fri May 10 13:26:03 2013 +0200 +++ b/include/freeDiameter/libfdproto.h Sun May 12 16:39:07 2013 +0200 @@ -472,9 +472,6 @@ } static __inline__ void replace_me() MARK_DEPRECATED { } -#define TRACE_sSA(...) replace_me(); -#define sSA_DUMP_NODE_SERV(...) replace_me(); -#define sSA_DUMP_NODE(...) replace_me(); #define TRACE_BUFFER(...) replace_me(); #define TRACE_NOTICE(...) replace_me(); diff -r 8401adfb58f5 -r 96f2051215c8 libfdcore/config.c --- a/libfdcore/config.c Fri May 10 13:26:03 2013 +0200 +++ b/libfdcore/config.c Sun May 12 16:39:07 2013 +0200 @@ -346,13 +346,11 @@ struct fd_endpoint * ep = (struct fd_endpoint *)li; if ( (fd_g_config->cnf_flags.no_ip4 && (ep->sa.sa_family == AF_INET)) ||(fd_g_config->cnf_flags.no_ip6 && (ep->sa.sa_family == AF_INET6)) ) { + char sa_buf[sSA_DUMP_STRLEN];; li = li->prev; fd_list_unlink(&ep->chain); - if (TRACE_BOOL(INFO)) { - char buf[1024]; - sSA_DUMP_NODE( buf, sizeof(buf), &ep->sa, NI_NUMERICHOST ); - fd_log_debug("Info: Removing local address conflicting with the flags no_IP / no_IP6 : %s", buf); - } + fd_sa_sdump_numeric(sa_buf, &ep->sa); + LOG_N("Info: Removing local address conflicting with the flags no_IP / no_IP6 : %s", sa_buf); free(ep); } } diff -r 8401adfb58f5 -r 96f2051215c8 libfdcore/core.c --- a/libfdcore/core.c Fri May 10 13:26:03 2013 +0200 +++ b/libfdcore/core.c Sun May 12 16:39:07 2013 +0200 @@ -219,12 +219,12 @@ /* Display configuration */ b = fd_conf_dump(&buf, &len, NULL); - LOG_N("%s\n", b ?: "Error during configuration dump..."); + LOG_N("%s", b ?: "Error during configuration dump..."); /* Display registered triggers for FDEV_TRIGGER */ b = fd_event_trig_dump(&buf, &len, &offset); if (!b || offset) { - LOG_N("%s\n", b ?: "Error during triggers dump..."); + LOG_N("%s", b ?: "Error during triggers dump..."); } free(buf); diff -r 8401adfb58f5 -r 96f2051215c8 libfdcore/sctp.c --- a/libfdcore/sctp.c Fri May 10 13:26:03 2013 +0200 +++ b/libfdcore/sctp.c Sun May 12 16:39:07 2013 +0200 @@ -738,7 +738,7 @@ goto redo; } - if (TRACE_BOOL(SCTP_LEVEL)) { + #if 0 union { sSA *sa; uint8_t *buf; @@ -750,7 +750,7 @@ TRACE_sSA(FD_LOG_DEBUG, FULL, " - ", ptr.sa, NI_NUMERICHOST | NI_NUMERICSERV, "" ); ptr.buf += (ptr.sa->sa_family == AF_INET) ? sizeof(sSA4) : sizeof(sSA6) ; } - } + #endif /* Bind to this array */ CHECK_SYS( sctp_bindx(*sock, sar, count, SCTP_BINDX_ADD_ADDR) ); @@ -763,7 +763,7 @@ CHECK_FCT( fd_setsockopt_postbind(*sock, bind_default) ); /* Debug: show all local listening addresses */ - if (TRACE_BOOL(SCTP_LEVEL)) { + #if 0 sSA *sar; union { sSA *sa; @@ -778,7 +778,7 @@ TRACE_sSA(FD_LOG_DEBUG, FULL, " - ", ptr.sa, NI_NUMERICHOST | NI_NUMERICSERV, "" ); } sctp_freeladdrs(sar); - } + #endif return 0; } @@ -829,8 +829,9 @@ CHECK_FCT_DO( ret = add_addresses_from_list_mask(&sar.buf, &size, &count, family, htons(port), list, EP_FL_CONF | EP_FL_DISC, 0 ), goto out ); /* Try connecting */ - if (TRACE_BOOL(FULL)) { - TRACE_DEBUG(FULL, "Attempting SCTP connection (%d addresses attempted) :", count); + LOG_A("Attempting SCTP connection (%d addresses attempted) ", count); + +#if 0 /* Dump the SAs */ union { uint8_t *buf; @@ -844,7 +845,7 @@ TRACE_sSA(FD_LOG_DEBUG, FULL, " - ", ptr.sa, NI_NUMERICHOST | NI_NUMERICSERV, "" ); ptr.buf += (ptr.sa->sa_family == AF_INET) ? sizeof(sSA4) : sizeof(sSA6); } - } +#endif #ifdef SCTP_CONNECTX_4_ARGS ret = sctp_connectx(*sock, sar.sa, count, NULL); @@ -907,9 +908,9 @@ TRACE_DEBUG(INFO, "Invalid size of socket option: %d / %zd", sz, sizeof(status)); return ENOTSUP; } - if (TRACE_BOOL(SCTP_LEVEL)) { - char buf[1024]; - sSA_DUMP_NODE_SERV(buf, sizeof(buf), &status.sstat_primary.spinfo_address, NI_NUMERICHOST | NI_NUMERICSERV ); +#if 0 + char sa_buf[sSA_DUMP_STRLEN]; + fd_sa_sdump_numeric(sa_buf, &status.sstat_primary.spinfo_address); fd_log_debug( "SCTP_STATUS : sstat_state : %i" , status.sstat_state); fd_log_debug( " sstat_rwnd : %u" , status.sstat_rwnd); fd_log_debug( " sstat_unackdata : %hu", status.sstat_unackdata); @@ -917,13 +918,13 @@ fd_log_debug( " sstat_instrms : %hu", status.sstat_instrms); fd_log_debug( " sstat_outstrms : %hu", status.sstat_outstrms); fd_log_debug( " sstat_fragmentation_point : %u" , status.sstat_fragmentation_point); - fd_log_debug( " sstat_primary.spinfo_address : %s" , buf); + fd_log_debug( " sstat_primary.spinfo_address : %s" , sa_buf); fd_log_debug( " sstat_primary.spinfo_state : %d" , status.sstat_primary.spinfo_state); fd_log_debug( " sstat_primary.spinfo_cwnd : %u" , status.sstat_primary.spinfo_cwnd); fd_log_debug( " sstat_primary.spinfo_srtt : %u" , status.sstat_primary.spinfo_srtt); fd_log_debug( " sstat_primary.spinfo_rto : %u" , status.sstat_primary.spinfo_rto); fd_log_debug( " sstat_primary.spinfo_mtu : %u" , status.sstat_primary.spinfo_mtu); - } +#endif /* 0 */ *in = status.sstat_instrms; *out = status.sstat_outstrms; @@ -1149,7 +1150,7 @@ case SCTP_PEER_ADDR_CHANGE: TRACE_DEBUG(FULL, "Received SCTP_PEER_ADDR_CHANGE notification"); - TRACE_sSA(FD_LOG_DEBUG, SCTP_LEVEL, " intf_change : ", &(notif->sn_paddr_change.spc_aaddr), NI_NUMERICHOST | NI_NUMERICSERV, "" ); + /* TRACE_sSA(FD_LOG_DEBUG, SCTP_LEVEL, " intf_change : ", &(notif->sn_paddr_change.spc_aaddr), NI_NUMERICHOST | NI_NUMERICSERV, "" ); */ TRACE_DEBUG(SCTP_LEVEL, " state : %d", notif->sn_paddr_change.spc_state); TRACE_DEBUG(SCTP_LEVEL, " error : %d", notif->sn_paddr_change.spc_error);