Navigation


Changeset 1120:c473581adff2 in freeDiameter


Ignore:
Timestamp:
May 14, 2013, 1:32:28 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Cleanup some traces

Files:
24 edited

Legend:

Unmodified
Added
Removed
  • extensions/app_diameap/diameap.c

    r732 r1120  
    6060        CHECK_FCT(fd_disp_app_support(dataobj_diameap_app, dataobj_diameap_ven, 1, 0));
    6161
    62         TRACE_DEBUG(INFO,"%sDiameter EAP Application Extension started successfully.",DIAMEAP_EXTENSION);
     62        LOG_D("%sDiameter EAP Application Extension started successfully.",DIAMEAP_EXTENSION);
    6363
    6464        return 0;
  • extensions/app_diameap/diameap_server.c

    r1088 r1120  
    32843284                        ;
    32853285
     3286                        LOG_N("%s Auth FAIL: %.*s",DIAMEAP_EXTENSION, diameap_sm->eap_sm.user.useridLength, diameap_sm->eap_sm.user.userid);
     3287                       
    32863288                        CHECK_FCT_DO( diameap_send(rmsg),
    32873289                                        goto s_end)
     
    33233325                                        {       TRACE_DEBUG(INFO,"%s Adding accounting AVP failed",DIAMEAP_EXTENSION); goto s_end;})
    33243326                        ;
     3327                       
     3328                        LOG_N("%s Auth Success: %.*s",DIAMEAP_EXTENSION, diameap_sm->eap_sm.user.useridLength, diameap_sm->eap_sm.user.userid);
     3329                       
    33253330                        CHECK_FCT_DO( diameap_send(rmsg),
    33263331                                        goto s_end)
  • extensions/dbg_monitor/dbg_monitor.c

    r1113 r1120  
    143143        TRACE_DEBUG(INFO, "%s", fd_conf_dump(&buf, &len, NULL));
    144144        TRACE_DEBUG(INFO, "[dbg_monitor] Dumping extensions information");
    145         TRACE_DEBUG(INFO, "%s", fd_ext_dump(&buf, &len, NULL));
     145        TRACE_DEBUG(INFO, "%s", fd_ext_dump(&buf, &len, NULL, 0));
    146146        TRACE_DEBUG(INFO, "[dbg_monitor] Dumping dictionary information");
    147147        TRACE_DEBUG(INFO, "%s", fd_dict_dump(&buf, &len, NULL, fd_g_config->cnf_dict));
  • extensions/dict_dcca/dict_dcca.c

    r885 r1120  
    14651465        }
    14661466    }
    1467     TRACE_DEBUG(INFO, "Extension 'Dictionary definitions for DCCA (rfc4006)' initialized");
     1467    LOG_D( "Extension 'Dictionary definitions for DCCA (rfc4006)' initialized");
    14681468    return 0;
    14691469}
  • extensions/dict_dcca_3gpp/dict_dcca_3gpp.c

    r1086 r1120  
    1075710757        }
    1075810758       
    10759         TRACE_DEBUG(INFO, "Extension 'Dictionary definitions for DCCA 3GPP' initialized");
     10759        LOG_D( "Extension 'Dictionary definitions for DCCA 3GPP' initialized");
    1076010760        return 0;
    1076110761}
  • extensions/dict_dcca_starent/dict_dcca_starent.c

    r962 r1120  
    283283
    284284
    285         TRACE_DEBUG(INFO, "Extension 'Dictionary definitions for DCCA Starent' initialized");
     285        LOG_D( "Extension 'Dictionary definitions for DCCA Starent' initialized");
    286286        return 0;
    287287}
  • extensions/dict_eap/dict_eap.c

    r879 r1120  
    513513        }
    514514       
    515         TRACE_DEBUG(INFO, "Extension 'Dictionary definitions for EAP' initialized");
     515        LOG_D( "Extension 'Dictionary definitions for EAP' initialized");
    516516        return 0;
    517517}
  • extensions/dict_mip6a/dict_mip6a.c

    r776 r1120  
    10891089                }
    10901090        }
    1091         TRACE_DEBUG(INFO, "Dictionary Extension 'Diameter Mobile IPv6 Auth (MIP6A)' initialized");
     1091        LOG_D( "Dictionary Extension 'Diameter Mobile IPv6 Auth (MIP6A)' initialized");
    10921092        return 0;
    10931093}
  • extensions/dict_mip6i/dict_mip6i.c

    r777 r1120  
    11321132        }
    11331133
    1134         TRACE_DEBUG(INFO, "Dictionary Extension 'Diameter Mobile IPv6 IKE (MIP6I)' initialized");
     1134        LOG_D( "Dictionary Extension 'Diameter Mobile IPv6 IKE (MIP6I)' initialized");
    11351135        return 0;
    11361136}
  • extensions/dict_nas_mipv6/dict_nas_mipv6.c

    r614 r1120  
    253253        }
    254254
    255         TRACE_DEBUG(INFO, "Dictionary Extension 'MIPv6 NAS-to-HAAA Interaction' initialized");
     255        LOG_D( "Dictionary Extension 'MIPv6 NAS-to-HAAA Interaction' initialized");
    256256        return 0;
    257257}
  • extensions/dict_nasreq/dict_nasreq.c

    r750 r1120  
    37293729        }
    37303730       
    3731         TRACE_DEBUG(INFO, "Extension 'Dictionary definitions for NASREQ' initialized");
     3731        LOG_D( "Extension 'Dictionary definitions for NASREQ' initialized");
    37323732        return 0;
    37333733}
  • extensions/dict_rfc5777/dict_rfc5777.c

    r774 r1120  
    21362136        }
    21372137
    2138         TRACE_DEBUG(INFO, "Dictionary Extension 'Traffic Classification and Quality of Service (QoS) Attributes for Diameter (RFC 5777)' initialized");
     2138        LOG_D( "Dictionary Extension 'Traffic Classification and Quality of Service (QoS) Attributes for Diameter (RFC 5777)' initialized");
    21392139        return 0;
    21402140}
  • extensions/dict_sip/dict_sip.c

    r614 r1120  
    29472947        }
    29482948       
    2949         TRACE_DEBUG(INFO, "Extension 'Dictionary definitions for SIP' initialized");
     2949        LOG_D( "Extension 'Dictionary definitions for SIP' initialized");
    29502950        return 0;
    29512951}
  • extensions/test_netemul/tne_process.c

    r972 r1120  
    106106                                CHECK_FCT( fd_msg_bufferize(m, &buf, &len) );
    107107                                CHECK_FCT( fd_msg_parse_buffer(&buf, len, &nm) );
    108                                 CHECK_FCT( fd_msg_source_set(nm, src, srclen, 0, NULL) );
     108                                CHECK_FCT( fd_msg_source_set(nm, src, srclen) );
    109109                                CHECK_FCT( fd_msg_hdr(nm, &nh) );
    110110                                nh->msg_flags |= CMD_FLAG_RETRANSMIT; /* Add the 'T' flag */
  • include/freeDiameter/libfdcore.h

    r1113 r1120  
    813813/* The "old" FD_EV_DUMP_* events are replaced with direct calls to the following dump functions */
    814814DECLARE_FD_DUMP_PROTOTYPE(fd_conf_dump);
    815 DECLARE_FD_DUMP_PROTOTYPE(fd_ext_dump);
     815DECLARE_FD_DUMP_PROTOTYPE(fd_ext_dump, int indent_next);
    816816DECLARE_FD_DUMP_PROTOTYPE(fd_servers_dump, int details);
    817817#endif /* SWIG */
  • include/freeDiameter/libfdproto.h

    r1119 r1120  
    25002500 *  msg         : A msg object.
    25012501 *  diamid,len  : The diameter id of the peer from which this message was received.
    2502  *  add_rr      : if true, a Route-Record AVP is added to the message with content diamid. In that case, dict must be supplied.
    2503  *  dict        : a dictionary with definition of Route-Record AVP (if add_rr is true)
     2502 *  dict        : a dictionary with definition of Route-Record AVP (for fd_msg_source_setrr)
    25042503 *
    25052504 * DESCRIPTION:
     
    25122511 *  !0          : an error occurred.
    25132512 */
    2514 int fd_msg_source_set( struct msg * msg, DiamId_t diamid, size_t diamidlen, int add_rr, struct dictionary * dict );
     2513int fd_msg_source_set( struct msg * msg, DiamId_t diamid, size_t diamidlen );
     2514int fd_msg_source_setrr( struct msg * msg, DiamId_t diamid, size_t diamidlen, struct dictionary * dict );
    25152515int fd_msg_source_get( struct msg * msg, DiamId_t *diamid, size_t * diamidlen );
    25162516
  • libfdcore/core.c

    r1119 r1120  
    257257        LOG_N("%s", b ?: "Error during configuration dump...");
    258258       
     259        /* Display extensions status */
     260        b = fd_ext_dump(&buf, &len, NULL, 19);
     261        LOG_N("Loaded extensions: %s", b ?: "Error during extensions dump...");
     262       
    259263        /* Display registered triggers for FDEV_TRIGGER */
    260264        b = fd_event_trig_dump(&buf, &len, &offset);
  • libfdcore/extensions.c

    r1113 r1120  
    7878
    7979/* Dump the list */
    80 DECLARE_FD_DUMP_PROTOTYPE(fd_ext_dump)
     80DECLARE_FD_DUMP_PROTOTYPE(fd_ext_dump, int indent_next)
    8181{
    8282        struct fd_list * li;
     
    8686        {
    8787                struct fd_ext_info * ext = (struct fd_ext_info *)li;
    88                 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "{extension}(@%p): '%s'[%s], %sloaded%s", ext, ext->filename, ext->conffile?:"no conf", ext->handler ? "" : "not ", (li->next == &ext_list) ? "":"\n"), return NULL);
     88                CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "%*s'%s'[%s], %sloaded%s", (li == ext_list.next) ? 0 : indent_next,"",
     89                                        ext->filename,
     90                                        ext->conffile?:"no conf",
     91                                        ext->handler ? "" : "not ", (li->next == &ext_list) ? "":"\n"), return NULL);
    8992        }
    9093        return *buf;
  • libfdcore/hooks.c

    r1103 r1120  
    333333                                if (msg) {
    334334                                        DiamId_t id = NULL;
    335                                         size_t idlen;
    336                                         if (!fd_msg_source_get( msg, &id, &idlen ))
     335                                        if (!fd_msg_source_get( msg, &id, NULL ))
    337336                                                id = (DiamId_t)"<error getting source>";
    338337                                       
     
    353352                        case HOOK_MESSAGE_ROUTING_ERROR: {
    354353                                DiamId_t id = NULL;
    355                                 size_t idlen;
    356                                 if (!fd_msg_source_get( msg, &id, &idlen ))
     354                                if (!fd_msg_source_get( msg, &id, NULL ))
    357355                                        id = (DiamId_t)"<error getting source>";
    358356
     
    397395                       
    398396                        case HOOK_PEER_CONNECT_SUCCESS: {
     397                                DiamId_t id = NULL;
     398                                if ((!fd_msg_source_get( msg, &id, NULL )) && (id == NULL)) { /* The CEA is locally issued */
     399                                        fd_msg_answ_getq(msg, &msg); /* We dump the CER in that case */
     400                                }
    399401                                CHECK_MALLOC_DO(fd_msg_dump_treeview(&buf, &len, NULL, msg, NULL, 0, 1), break);
    400402                                LOG_N("Connected to '%s', remote capabilities: %s", peer ? peer->p_hdr.info.pi_diamid : "<unknown>", buf);
  • libfdcore/messages.c

    r1113 r1120  
    318318        struct msg_hdr *hdr;
    319319        DiamId_t diamid;
    320         size_t diamidlen;
    321320       
    322321        /* Save the callback in the message, with the timeout */
     
    326325        if ( (fd_msg_hdr(*pmsg, &hdr) == 0)
    327326         &&  (hdr->msg_flags & CMD_FLAG_REQUEST)
    328          &&  (fd_msg_source_get(*pmsg, &diamid, &diamidlen) == 0)
     327         &&  (fd_msg_source_get(*pmsg, &diamid, NULL) == 0)
    329328         &&  (diamid == NULL)) {
    330329                fd_hook_call(HOOK_MESSAGE_LOCAL, *pmsg, NULL, NULL, fd_msg_pmdl_get(*pmsg));
  • libfdcore/p_psm.c

    r1118 r1120  
    282282                return 0;
    283283       
    284         TRACE_DEBUG(((old == STATE_OPEN) || (new_state == STATE_OPEN)) ? INFO : FULL, "'%s'\t-> '%s'\t'%s'",
     284        LOG(((old == STATE_OPEN) || (new_state == STATE_OPEN)) ? FD_LOG_NOTICE : FD_LOG_DEBUG, "'%s'\t-> '%s'\t'%s'",
    285285                        STATE_STR(old),
    286286                        STATE_STR(new_state),
     
    500500                       
    501501                fd_hook_associate(msg, pmdl);
     502                CHECK_FCT_DO( fd_msg_source_set( msg, peer->p_hdr.info.pi_diamid, peer->p_hdr.info.pi_diamidlen), goto psm_end);
    502503       
    503504                /* If the current state does not allow receiving messages, just drop it */
     
    557558
    558559                                        /* Set the message source and add the Route-Record */
    559                                         CHECK_FCT_DO( fd_msg_source_set( msg, peer->p_hdr.info.pi_diamid, peer->p_hdr.info.pi_diamidlen, 1, fd_g_config->cnf_dict ), goto psm_end);
     560                                        CHECK_FCT_DO( fd_msg_source_setrr( msg, peer->p_hdr.info.pi_diamid, peer->p_hdr.info.pi_diamidlen, fd_g_config->cnf_dict ), goto psm_end);
    560561
    561562                                        /* Requeue to the global incoming queue */
     
    742743                        char * buf = NULL;
    743744                        size_t len = 0;
    744                         LOG_D("New remote endpoint(s): %s",  fd_ep_dump(&buf, &len, NULL, 0, 0, &peer->p_hdr.info.pi_endpoints) ?: "error");
     745                        LOG_D("Got low layer notification (IGNORED): remote endpoint(s) changed: %s",  fd_ep_dump(&buf, &len, NULL, 0, 0, &peer->p_hdr.info.pi_endpoints) ?: "error");
    745746                        free(buf);
    746747                }
  • libfdcore/routing_dispatch.c

    r1119 r1120  
    551551        int is_err = 0;
    552552        DiamId_t qry_src = NULL;
    553         size_t   qry_src_len = 0;
    554553        struct msg *msgptr = msg;
    555554
     
    751750                /* Retrieve the corresponding query and its origin */
    752751                CHECK_FCT( fd_msg_answ_getq( msgptr, &qry ) );
    753                 CHECK_FCT( fd_msg_source_get( qry, &qry_src, &qry_src_len ) );
     752                CHECK_FCT( fd_msg_source_get( qry, &qry_src, NULL ) );
    754753
    755754                if ((!qry_src) && (!is_err)) {
  • libfdproto/messages.c

    r1119 r1120  
    804804        CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "  Command Code: %u\n", msg->msg_public.msg_code), return NULL);
    805805        CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "  ApplicationId: %d\n", msg->msg_public.msg_appl), return NULL);
    806         CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "  Hop-by-Hop Identifier: 0x%8X\n", msg->msg_public.msg_hbhid), return NULL);
    807         CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "  End-to-End Identifier: 0x%8X\n", msg->msg_public.msg_eteid), return NULL);
     806        CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "  Hop-by-Hop Identifier: 0x%08X\n", msg->msg_public.msg_hbhid), return NULL);
     807        CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "  End-to-End Identifier: 0x%08X\n", msg->msg_public.msg_eteid), return NULL);
    808808        CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "   {debug data}: src:%s(%zd) rwb:%p rt:%d cb:%p,%p(%p) qry:%p asso:%d sess:%p", msg->msg_src_id?:"(nil)", msg->msg_src_id_len, msg->msg_rawbuffer, msg->msg_routable, msg->msg_cb.anscb, msg->msg_cb.expirecb, msg->msg_cb.data, msg->msg_query, msg->msg_associated, msg->msg_sess), return NULL);
    809809       
     
    10711071                        CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, " {"), return NULL);
    10721072                } else {
    1073                         CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "+"), return NULL);
     1073                        CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, ","), return NULL);
    10741074                }
    10751075        }
     
    11311131                /* For embedded AVPs, we only display (vendor,) code & length */
    11321132                if (avp->avp_public.avp_flags & AVP_FLAG_VENDOR) {
    1133                         CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "V=%u,", avp->avp_public.avp_vendor), return NULL);
    1134                 }
    1135                 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "C=%u,L=%d", avp->avp_public.avp_code, avp->avp_public.avp_len), return NULL);
     1133                        CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "V:%u/", avp->avp_public.avp_vendor), return NULL);
     1134                }
     1135                CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "C:%u/l:%d", avp->avp_public.avp_code, avp->avp_public.avp_len), return NULL);
    11361136        }
    11371137       
     
    13421342
    13431343/* Associate source peer */
    1344 int fd_msg_source_set( struct msg * msg, DiamId_t diamid, size_t diamidlen, int add_rr, struct dictionary * dict )
    1345 {
    1346         TRACE_ENTRY( "%p %p %zd %d %p", msg, diamid, diamidlen, add_rr, dict);
     1344int fd_msg_source_set( struct msg * msg, DiamId_t diamid, size_t diamidlen )
     1345{
     1346        TRACE_ENTRY( "%p %p %zd", msg, diamid, diamidlen);
    13471347       
    13481348        /* Check we received a valid message */
    1349         CHECK_PARAMS( CHECK_MSG(msg) && ( (! add_rr) || dict ) );
     1349        CHECK_PARAMS( CHECK_MSG(msg) );
    13501350       
    13511351        /* Cleanup any previous source */
     
    13601360        CHECK_MALLOC( msg->msg_src_id = os0dup(diamid, diamidlen) );
    13611361        msg->msg_src_id_len = diamidlen;
    1362        
    1363        
    1364         if (add_rr) {
    1365                 struct dict_object      *avp_rr_model = NULL;
    1366                 avp_code_t               code = AC_ROUTE_RECORD;
    1367                 struct avp              *avp;
    1368                 union avp_value          val;
    1369                
    1370                 /* Lock the cached values */
     1362        /* done */
     1363        return 0;
     1364}
     1365
     1366/* Associate source peer */
     1367int fd_msg_source_setrr( struct msg * msg, DiamId_t diamid, size_t diamidlen, struct dictionary * dict )
     1368{
     1369        struct dict_object      *avp_rr_model = NULL;
     1370        avp_code_t               code = AC_ROUTE_RECORD;
     1371        struct avp              *avp;
     1372        union avp_value          val;
     1373
     1374        TRACE_ENTRY( "%p %p %zd %p", msg, diamid, diamidlen, dict);
     1375       
     1376        /* Check we received a valid message */
     1377        CHECK_PARAMS( CHECK_MSG(msg) && dict );
     1378       
     1379        /* Lock the cached values */
     1380        CHECK_POSIX( pthread_mutex_lock(&cached_avp_rr_lock) );
     1381        if (cached_avp_rr_dict == dict) {
     1382                avp_rr_model = cached_avp_rr_model;
     1383        }
     1384        CHECK_POSIX( pthread_mutex_unlock(&cached_avp_rr_lock) );
     1385
     1386        /* If it was not cached */
     1387        if (!avp_rr_model) {
     1388                /* Find the model for Route-Record in the dictionary */
     1389                CHECK_FCT( fd_dict_search ( dict, DICT_AVP, AVP_BY_CODE, &code, &avp_rr_model, ENOENT) );
     1390
     1391                /* Now cache this result */
    13711392                CHECK_POSIX( pthread_mutex_lock(&cached_avp_rr_lock) );
    1372                 if (cached_avp_rr_dict == dict) {
    1373                         avp_rr_model = cached_avp_rr_model;
    1374                 }
     1393                cached_avp_rr_dict  = dict;
     1394                cached_avp_rr_model = avp_rr_model;
    13751395                CHECK_POSIX( pthread_mutex_unlock(&cached_avp_rr_lock) );
    1376                
    1377                 /* If it was not cached */
    1378                 if (!avp_rr_model) {
    1379                         /* Find the model for Route-Record in the dictionary */
    1380                         CHECK_FCT( fd_dict_search ( dict, DICT_AVP, AVP_BY_CODE, &code, &avp_rr_model, ENOENT) );
    1381                        
    1382                         /* Now cache this result */
    1383                         CHECK_POSIX( pthread_mutex_lock(&cached_avp_rr_lock) );
    1384                         cached_avp_rr_dict  = dict;
    1385                         cached_avp_rr_model = avp_rr_model;
    1386                         CHECK_POSIX( pthread_mutex_unlock(&cached_avp_rr_lock) );
    1387                 }
    1388                
    1389                 /* Create the AVP with this model */
    1390                 CHECK_FCT( fd_msg_avp_new ( avp_rr_model, 0, &avp ) );
    1391                
    1392                 /* Set the AVP value with the diameter id */
    1393                 memset(&val, 0, sizeof(val));
    1394                 val.os.data = (uint8_t *)diamid;
    1395                 val.os.len  = diamidlen;
    1396                 CHECK_FCT( fd_msg_avp_setvalue( avp, &val ) );
    1397 
    1398                 /* Add the AVP in the message */
    1399                 CHECK_FCT( fd_msg_avp_add( msg, MSG_BRW_LAST_CHILD, avp ) );
    1400         }
     1396        }
     1397
     1398        /* Create the AVP with this model */
     1399        CHECK_FCT( fd_msg_avp_new ( avp_rr_model, 0, &avp ) );
     1400
     1401        /* Set the AVP value with the diameter id */
     1402        memset(&val, 0, sizeof(val));
     1403        val.os.data = (uint8_t *)diamid;
     1404        val.os.len  = diamidlen;
     1405        CHECK_FCT( fd_msg_avp_setvalue( avp, &val ) );
     1406
     1407        /* Add the AVP in the message */
     1408        CHECK_FCT( fd_msg_avp_add( msg, MSG_BRW_LAST_CHILD, avp ) );
    14011409       
    14021410        /* done */
  • tests/testappacct.c

    r773 r1120  
    239239               
    240240                /* Source */
    241                 CHECK( 0, fd_msg_source_set( msg, "peer3", CONSTSTRLEN("peer3"), 1, fd_g_config->cnf_dict ) );
     241                CHECK( 0, fd_msg_source_set( msg, "peer3", CONSTSTRLEN("peer3") ) );
     242                CHECK( 0, fd_msg_source_setrr( msg, "peer3", CONSTSTRLEN("peer3"), fd_g_config->cnf_dict ) );
    242243        }
    243244       
Note: See TracChangeset for help on using the changeset viewer.