Changes in / [964:992ef1167344:963:8702913eb443] in freeDiameter
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
include/freeDiameter/CMakeLists.txt
r935 r933 29 29 OPTION(DISABLE_PEER_EXPIRY "Disable RFC3539 Peers Connections Expiration after inactivity?" OFF) 30 30 31 # The following workaround increases compatibility with some implementations without breaking anything in freeDiameter, 32 # so it can be enabled without risk. We keep it disabled by default anyway for those people who use freeDiameter to check the 33 # compliancy of their implementation with the Diameter RFC... 34 OPTION(WORKAROUND_ACCEPT_INVALID_VSAI "Do not reject a CER/CEA with a Vendor-Specific-Application-Id AVP containing both Auth- and Acct- application AVPs?" OFF) 35 36 MARK_AS_ADVANCED(DISABLE_SCTP DEBUG_SCTP SCTP_USE_MAPPED_ADDRESSES ERRORS_ON_TODO DIAMID_IDNA_IGNORE DIAMID_IDNA_REJECT DISABLE_PEER_EXPIRY WORKAROUND_ACCEPT_INVALID_VSAI) 31 32 MARK_AS_ADVANCED(DISABLE_SCTP DEBUG_SCTP SCTP_USE_MAPPED_ADDRESSES ERRORS_ON_TODO DIAMID_IDNA_IGNORE DIAMID_IDNA_REJECT DISABLE_PEER_EXPIRY) 37 33 38 34 ######################## -
include/freeDiameter/freeDiameter-host.h.in
r935 r933 60 60 #cmakedefine DIAMID_IDNA_REJECT 61 61 #cmakedefine DISABLE_PEER_EXPIRY 62 #cmakedefine WORKAROUND_ACCEPT_INVALID_VSAI63 62 #cmakedefine GNUTLS_VERSION_210 64 63 #cmakedefine GNUTLS_VERSION_300 -
libfdcore/fdd.y
r964 r961 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)); 331 } else { 332 fclose(fd); 333 } 330 TRACE_DEBUG_ERROR("Unable to open extension file %s for reading: %s\n", fname, strerror(ret)); 331 yyerror (&yylloc, conf, "Error adding extension"); 332 YYERROR; 333 } 334 fclose(fd); 334 335 335 336 /* Try and open the configuration file (optional) */ -
libfdcore/p_ce.c
r935 r837 455 455 { 456 456 struct avp * inavp = NULL; 457 application_id_t aid = 0; 457 458 vendor_id_t vid = 0; 458 application_id_t auth_aid = 0; 459 application_id_t acct_aid = 0; 460 int invalid=0; 459 int auth = 0; 460 int acct = 0; 461 461 462 462 /* get the first child AVP */ … … 482 482 switch (inhdr->avp_code) { 483 483 case AC_VENDOR_ID: /* Vendor-Id */ 484 if (vid != 0)485 invalid++; /* We already had one such AVP */486 484 vid = inhdr->avp_value->u32; 487 485 break; 488 486 case AC_AUTH_APPLICATION_ID: /* Auth-Application-Id */ 489 if (auth_aid != 0) 490 invalid++; /* We already had one such AVP */ 491 #ifndef WORKAROUND_ACCEPT_INVALID_VSAI 492 if (acct_aid != 0) 493 invalid++; /* Only 1 *-Application-Id AVP is allowed */ 494 #endif /* WORKAROUND_ACCEPT_INVALID_VSAI */ 495 auth_aid = inhdr->avp_value->u32; 487 aid = inhdr->avp_value->u32; 488 auth += 1; 496 489 break; 497 490 case AC_ACCT_APPLICATION_ID: /* Acct-Application-Id */ 498 if (acct_aid != 0) 499 invalid++; /* We already had one such AVP */ 500 #ifndef WORKAROUND_ACCEPT_INVALID_VSAI 501 if (auth_aid != 0) 502 invalid++; /* Only 1 *-Application-Id AVP is allowed */ 503 #endif /* WORKAROUND_ACCEPT_INVALID_VSAI */ 504 acct_aid = inhdr->avp_value->u32; 491 aid = inhdr->avp_value->u32; 492 acct += 1; 505 493 break; 506 494 /* ignore other AVPs */ 507 }508 509 if (invalid) {510 TRACE_DEBUG(FULL, "Invalid Vendor-Specific-Application-Id AVP received, ignored");511 fd_msg_dump_one(FULL, avp);512 error->pei_errcode = "DIAMETER_INVALID_AVP_VALUE";513 error->pei_avp = avp;514 return EINVAL;515 495 } 516 496 … … 520 500 } 521 501 522 /* Add entry in the list */ 523 if (auth_aid) { 524 CHECK_FCT( fd_app_merge(&peer->p_hdr.info.runtime.pir_apps, auth_aid, vid, 1, 0) ); 525 } 526 if (acct_aid) { 527 CHECK_FCT( fd_app_merge(&peer->p_hdr.info.runtime.pir_apps, acct_aid, vid, 0, 1) ); 502 if (auth + acct != 1) { 503 TRACE_DEBUG(FULL, "Invalid Vendor-Specific-Application-Id AVP received, ignored"); 504 fd_msg_dump_one(FULL, avp); 505 error->pei_errcode = "DIAMETER_INVALID_AVP_VALUE"; 506 error->pei_avp = avp; 507 return EINVAL; 508 } else { 509 /* Add an entry in the list */ 510 CHECK_FCT( fd_app_merge(&peer->p_hdr.info.runtime.pir_apps, aid, vid, auth, acct) ); 528 511 } 529 512 } -
libfdcore/routing_dispatch.c
r934 r754 424 424 425 425 /* The DISPATCH message processing */ 426 static int msg_dispatch(struct msg * 426 static int msg_dispatch(struct msg ** pmsg) 427 427 { 428 428 struct msg_hdr * hdr; … … 432 432 char * ec = NULL; 433 433 char * em = NULL; 434 struct msg *msgptr = msg;435 434 436 435 /* Read the message header */ 437 CHECK_FCT( fd_msg_hdr( msg, &hdr) );436 CHECK_FCT( fd_msg_hdr(*pmsg, &hdr) ); 438 437 is_req = hdr->msg_flags & CMD_FLAG_REQUEST; 439 438 … … 442 441 443 442 /* At this point, we need to understand the message content, so parse it */ 444 CHECK_FCT_DO( ret = fd_msg_parse_or_error( &msgptr),443 CHECK_FCT_DO( ret = fd_msg_parse_or_error( pmsg ), 445 444 { 446 445 /* in case of error */ 447 if ((ret == EBADMSG) && (msgptr != NULL)) { 448 /* msgptr now contains the answer message to send back */ 449 CHECK_FCT( fd_fifo_post(fd_g_outgoing, &msgptr) ); 450 } 451 if (msgptr) { /* another error happen'd */ 452 fd_msg_log( FD_MSG_LOG_DROPPED, msgptr, "An unexpected error occurred while parsing the message (%s)", strerror(ret)); 453 CHECK_FCT_DO( fd_msg_free(msgptr), /* continue */); 446 if ((ret == EBADMSG) && (*pmsg != NULL)) { 447 /* msg now contains the answer message to send back */ 448 CHECK_FCT( fd_fifo_post(fd_g_outgoing, pmsg) ); 449 } 450 if (*pmsg) { /* another error happen'd */ 451 fd_msg_log( FD_MSG_LOG_DROPPED, *pmsg, "An unexpected error occurred while parsing the message (%s)", strerror(ret)); 452 CHECK_FCT_DO( fd_msg_free(*pmsg), /* continue */); 453 *pmsg = NULL; 454 454 } 455 455 /* We're done with this one */ … … 464 464 465 465 /* Retrieve the corresponding query */ 466 CHECK_FCT( fd_msg_answ_getq( msgptr, &qry ) );466 CHECK_FCT( fd_msg_answ_getq( *pmsg, &qry ) ); 467 467 468 468 /* Retrieve any registered handler */ … … 473 473 474 474 TRACE_DEBUG(FULL, "Calling callback registered when query was sent (%p, %p)", anscb, data); 475 (*anscb)(data, &msgptr);475 (*anscb)(data, pmsg); 476 476 477 477 /* If the message is processed, we're done */ 478 if ( msgptr== NULL) {478 if (*pmsg == NULL) { 479 479 return 0; 480 480 } 481 482 /* otherwise continue the dispatching --hoping that the anscb callback did not mess with our message :) */483 481 } 484 482 } 485 483 486 484 /* Retrieve the session of the message */ 487 CHECK_FCT( fd_msg_sess_get(fd_g_config->cnf_dict, msgptr, &sess, NULL) );485 CHECK_FCT( fd_msg_sess_get(fd_g_config->cnf_dict, *pmsg, &sess, NULL) ); 488 486 489 487 /* Now, call any callback registered for the message */ 490 CHECK_FCT( fd_msg_dispatch ( &msgptr, sess, &action, &ec) );488 CHECK_FCT( fd_msg_dispatch ( pmsg, sess, &action, &ec) ); 491 489 492 490 /* Now, act depending on msg and action and ec */ 493 if ( msgptr) {491 if (*pmsg) 494 492 switch ( action ) { 495 493 case DISP_ACT_CONT: … … 497 495 if (!fd_g_config->cnf_flags.no_fwd) { 498 496 /* requeue to fd_g_outgoing */ 499 CHECK_FCT( fd_fifo_post(fd_g_outgoing, &msgptr) );497 CHECK_FCT( fd_fifo_post(fd_g_outgoing, pmsg) ); 500 498 break; 501 499 } … … 511 509 512 510 if (!is_req) { 513 fd_msg_log( FD_MSG_LOG_DROPPED, msgptr, "Internal error: Answer received to locally issued request, but not handled by any handler."); 514 fd_msg_free(msgptr); 511 fd_msg_log( FD_MSG_LOG_DROPPED, *pmsg, "Internal error: Answer received to locally issued request, but not handled by any handler."); 512 fd_msg_free(*pmsg); 513 *pmsg = NULL; 515 514 break; 516 515 } 517 516 518 517 /* Create an answer with the error code and message */ 519 CHECK_FCT( fd_msg_new_answer_from_req ( fd_g_config->cnf_dict, &msgptr, 0 ) );520 CHECK_FCT( fd_msg_rescode_set( msgptr, ec, em, NULL, 1 ) );518 CHECK_FCT( fd_msg_new_answer_from_req ( fd_g_config->cnf_dict, pmsg, 0 ) ); 519 CHECK_FCT( fd_msg_rescode_set(*pmsg, ec, em, NULL, 1 ) ); 521 520 522 521 case DISP_ACT_SEND: 523 522 /* Now, send the message */ 524 CHECK_FCT( fd_fifo_post(fd_g_outgoing, &msgptr) ); 525 } 526 } 523 CHECK_FCT( fd_fifo_post(fd_g_outgoing, pmsg) ); 524 } 527 525 528 526 /* We're done with dispatching this message */ … … 531 529 532 530 /* The ROUTING-IN message processing */ 533 static int msg_rt_in(struct msg * 531 static int msg_rt_in(struct msg ** pmsg) 534 532 { 535 533 struct msg_hdr * hdr; … … 538 536 DiamId_t qry_src = NULL; 539 537 size_t qry_src_len = 0; 540 struct msg *msgptr = msg;541 538 542 539 /* Read the message header */ 543 CHECK_FCT( fd_msg_hdr( msg, &hdr) );540 CHECK_FCT( fd_msg_hdr(*pmsg, &hdr) ); 544 541 is_req = hdr->msg_flags & CMD_FLAG_REQUEST; 545 542 is_err = hdr->msg_flags & CMD_FLAG_ERROR; … … 547 544 /* Handle incorrect bits */ 548 545 if (is_req && is_err) { 549 CHECK_FCT( return_error( &msgptr, "DIAMETER_INVALID_HDR_BITS", "R & E bits were set", NULL) );546 CHECK_FCT( return_error( pmsg, "DIAMETER_INVALID_HDR_BITS", "R & E bits were set", NULL) ); 550 547 return 0; 551 548 } … … 567 564 TRACE_DEBUG(INFO, "Received a routable message with application id 0 or " _stringize(AI_RELAY) " (relay),\n" 568 565 " returning DIAMETER_APPLICATION_UNSUPPORTED"); 569 CHECK_FCT( return_error( &msgptr, "DIAMETER_APPLICATION_UNSUPPORTED", "Routable message with application id 0 or relay", NULL) );566 CHECK_FCT( return_error( pmsg, "DIAMETER_APPLICATION_UNSUPPORTED", "Routable message with application id 0 or relay", NULL) ); 570 567 return 0; 571 568 } else { … … 576 573 577 574 /* Parse the message for Dest-Host and Dest-Realm */ 578 CHECK_FCT( fd_msg_browse( msgptr, MSG_BRW_FIRST_CHILD, &avp, NULL) );575 CHECK_FCT( fd_msg_browse(*pmsg, MSG_BRW_FIRST_CHILD, &avp, NULL) ); 579 576 while (avp) { 580 577 struct avp_hdr * ahdr; … … 593 590 { 594 591 if (error_info.pei_errcode) { 595 CHECK_FCT( return_error( &msgptr, error_info.pei_errcode, error_info.pei_message, error_info.pei_avp) );592 CHECK_FCT( return_error( pmsg, error_info.pei_errcode, error_info.pei_message, error_info.pei_avp) ); 596 593 return 0; 597 594 } else { … … 613 610 { 614 611 if (error_info.pei_errcode) { 615 CHECK_FCT( return_error( &msgptr, error_info.pei_errcode, error_info.pei_message, error_info.pei_avp) );612 CHECK_FCT( return_error( pmsg, error_info.pei_errcode, error_info.pei_message, error_info.pei_avp) ); 616 613 return 0; 617 614 } else { … … 635 632 { 636 633 if (error_info.pei_errcode) { 637 CHECK_FCT( return_error( &msgptr, error_info.pei_errcode, error_info.pei_message, error_info.pei_avp) );634 CHECK_FCT( return_error( pmsg, error_info.pei_errcode, error_info.pei_message, error_info.pei_avp) ); 638 635 return 0; 639 636 } else { … … 660 657 /* Handle the missing routing AVPs first */ 661 658 if ( is_dest_realm == UNKNOWN ) { 662 CHECK_FCT( return_error( &msgptr, "DIAMETER_COMMAND_UNSUPPORTED", "Non-routable message not supported (invalid bit ? missing Destination-Realm ?)", NULL) );659 CHECK_FCT( return_error( pmsg, "DIAMETER_COMMAND_UNSUPPORTED", "Non-routable message not supported (invalid bit ? missing Destination-Realm ?)", NULL) ); 663 660 return 0; 664 661 } … … 668 665 if (is_local_app == YES) { 669 666 /* Ok, give the message to the dispatch thread */ 670 CHECK_FCT( fd_fifo_post(fd_g_local, &msgptr) );667 CHECK_FCT( fd_fifo_post(fd_g_local, pmsg) ); 671 668 } else { 672 669 /* We don't support the application, reply an error */ 673 CHECK_FCT( return_error( &msgptr, "DIAMETER_APPLICATION_UNSUPPORTED", NULL, NULL) );670 CHECK_FCT( return_error( pmsg, "DIAMETER_APPLICATION_UNSUPPORTED", NULL, NULL) ); 674 671 } 675 672 return 0; … … 679 676 if ((is_dest_host == NO) || (is_dest_realm == NO)) { 680 677 if (fd_g_config->cnf_flags.no_fwd) { 681 CHECK_FCT( return_error( &msgptr, "DIAMETER_UNABLE_TO_DELIVER", "I am not a Diameter agent", NULL) );678 CHECK_FCT( return_error( pmsg, "DIAMETER_UNABLE_TO_DELIVER", "I am not a Diameter agent", NULL) ); 682 679 return 0; 683 680 } … … 692 689 { 693 690 /* If the process failed, we assume it is because of the AVP format */ 694 CHECK_FCT( return_error( &msgptr, "DIAMETER_INVALID_AVP_VALUE", "Failed to process decorated NAI", un) );691 CHECK_FCT( return_error( pmsg, "DIAMETER_INVALID_AVP_VALUE", "Failed to process decorated NAI", un) ); 695 692 return 0; 696 693 } ); … … 699 696 if (is_nai) { 700 697 /* We have transformed the AVP, now submit it again in the queue */ 701 CHECK_FCT(fd_fifo_post(fd_g_incoming, &msgptr) );698 CHECK_FCT(fd_fifo_post(fd_g_incoming, pmsg) ); 702 699 return 0; 703 700 } … … 705 702 if (is_local_app == YES) { 706 703 /* Handle localy since we are able to */ 707 CHECK_FCT(fd_fifo_post(fd_g_local, &msgptr) );704 CHECK_FCT(fd_fifo_post(fd_g_local, pmsg) ); 708 705 return 0; 709 706 } … … 711 708 if (fd_g_config->cnf_flags.no_fwd) { 712 709 /* We return an error */ 713 CHECK_FCT( return_error( &msgptr, "DIAMETER_APPLICATION_UNSUPPORTED", NULL, NULL) );710 CHECK_FCT( return_error( pmsg, "DIAMETER_APPLICATION_UNSUPPORTED", NULL, NULL) ); 714 711 return 0; 715 712 } … … 723 720 724 721 /* Retrieve the corresponding query and its origin */ 725 CHECK_FCT( fd_msg_answ_getq( msgptr, &qry ) );722 CHECK_FCT( fd_msg_answ_getq( *pmsg, &qry ) ); 726 723 CHECK_FCT( fd_msg_source_get( qry, &qry_src, &qry_src_len ) ); 727 724 728 725 if ((!qry_src) && (!is_err)) { 729 726 /* The message is a normal answer to a request issued localy, we do not call the callbacks chain on it. */ 730 CHECK_FCT(fd_fifo_post(fd_g_local, &msgptr) );727 CHECK_FCT(fd_fifo_post(fd_g_local, pmsg) ); 731 728 return 0; 732 729 } … … 743 740 744 741 /* requests: dir = 1 & 2 => in order; answers = 3 & 2 => in reverse order */ 745 for ( li = (is_req ? rt_fwd_list.next : rt_fwd_list.prev) ; msgptr&& (li != &rt_fwd_list) ; li = (is_req ? li->next : li->prev) ) {742 for ( li = (is_req ? rt_fwd_list.next : rt_fwd_list.prev) ; *pmsg && (li != &rt_fwd_list) ; li = (is_req ? li->next : li->prev) ) { 746 743 struct rt_hdl * rh = (struct rt_hdl *)li; 747 744 int ret; … … 753 750 754 751 /* Ok, call this cb */ 755 TRACE_DEBUG(ANNOYING, "Calling next FWD callback on %p : %p", msgptr, rh->rt_fwd_cb);756 CHECK_FCT_DO( ret = (*rh->rt_fwd_cb)(rh->cbdata, &msgptr),752 TRACE_DEBUG(ANNOYING, "Calling next FWD callback on %p : %p", *pmsg, rh->rt_fwd_cb); 753 CHECK_FCT_DO( ret = (*rh->rt_fwd_cb)(rh->cbdata, pmsg), 757 754 { 758 fd_msg_log( FD_MSG_LOG_DROPPED, msgptr, "Internal error: a FWD routing callback returned an error (%s)", strerror(ret));759 fd_msg_free( msgptr);760 msgptr= NULL;755 fd_msg_log( FD_MSG_LOG_DROPPED, *pmsg, "Internal error: a FWD routing callback returned an error (%s)", strerror(ret)); 756 fd_msg_free(*pmsg); 757 *pmsg = NULL; 761 758 } ); 762 759 } … … 766 763 767 764 /* If a callback has handled the message, we stop now */ 768 if (! msgptr)765 if (!*pmsg) 769 766 return 0; 770 767 } … … 772 769 /* Now pass the message to the next step: either forward to another peer, or dispatch to local extensions */ 773 770 if (is_req || qry_src) { 774 CHECK_FCT(fd_fifo_post(fd_g_outgoing, &msgptr) );771 CHECK_FCT(fd_fifo_post(fd_g_outgoing, pmsg) ); 775 772 } else { 776 CHECK_FCT(fd_fifo_post(fd_g_local, &msgptr) );773 CHECK_FCT(fd_fifo_post(fd_g_local, pmsg) ); 777 774 } 778 775 … … 783 780 784 781 /* The ROUTING-OUT message processing */ 785 static int msg_rt_out(struct msg * 782 static int msg_rt_out(struct msg ** pmsg) 786 783 { 787 784 struct rt_data * rtd = NULL; … … 792 789 struct avp * avp; 793 790 struct rtd_candidate * c; 794 struct msg *msgptr = msg;795 791 796 792 /* Read the message header */ 797 CHECK_FCT( fd_msg_hdr( msgptr, &hdr) );793 CHECK_FCT( fd_msg_hdr(*pmsg, &hdr) ); 798 794 is_req = hdr->msg_flags & CMD_FLAG_REQUEST; 799 795 … … 807 803 808 804 /* Retrieve the corresponding query and its origin */ 809 CHECK_FCT( fd_msg_answ_getq( msgptr, &qry ) );805 CHECK_FCT( fd_msg_answ_getq( *pmsg, &qry ) ); 810 806 CHECK_FCT( fd_msg_source_get( qry, &qry_src, &qry_src_len ) ); 811 807 … … 815 811 CHECK_FCT( fd_peer_getbyid( qry_src, qry_src_len, 0, (void *) &peer ) ); 816 812 if (fd_peer_getstate(peer) != STATE_OPEN) { 817 fd_msg_log( FD_MSG_LOG_DROPPED, msgptr, "Unable to forward answer to deleted / closed peer '%s'.", qry_src); 818 fd_msg_free(msgptr); 813 fd_msg_log( FD_MSG_LOG_DROPPED, *pmsg, "Unable to forward answer to deleted / closed peer '%s'.", qry_src); 814 fd_msg_free(*pmsg); 815 *pmsg = NULL; 819 816 return 0; 820 817 } … … 825 822 826 823 /* Push the message into this peer */ 827 CHECK_FCT( fd_out_send( &msgptr, NULL, peer, 0) );824 CHECK_FCT( fd_out_send(pmsg, NULL, peer, 0) ); 828 825 829 826 /* We're done with this answer */ … … 834 831 835 832 /* Get the routing data out of the message if any (in case of re-transmit) */ 836 CHECK_FCT( fd_msg_rt_get ( msgptr, &rtd ) );833 CHECK_FCT( fd_msg_rt_get ( *pmsg, &rtd ) ); 837 834 838 835 /* If there is no routing data already, let's create it */ … … 854 851 855 852 /* Now let's remove all peers from the Route-Records */ 856 CHECK_FCT( fd_msg_browse( msgptr, MSG_BRW_FIRST_CHILD, &avp, NULL) );853 CHECK_FCT( fd_msg_browse(*pmsg, MSG_BRW_FIRST_CHILD, &avp, NULL) ); 857 854 while (avp) { 858 855 struct avp_hdr * ahdr; … … 865 862 { 866 863 if (error_info.pei_errcode) { 867 CHECK_FCT( return_error( &msgptr, error_info.pei_errcode, error_info.pei_message, error_info.pei_avp) );864 CHECK_FCT( return_error( pmsg, error_info.pei_errcode, error_info.pei_message, error_info.pei_avp) ); 868 865 return 0; 869 866 } else { … … 886 883 fd_rtd_candidate_extract(rtd, &candidates, FD_SCORE_INI); 887 884 888 /* Pass the list to registered callbacks (even if it is empty list) */885 /* Pass the list to registered callbacks (even if it is empty) */ 889 886 { 890 887 CHECK_FCT( pthread_rwlock_rdlock( &rt_out_lock ) ); … … 895 892 struct rt_hdl * rh = (struct rt_hdl *)li; 896 893 897 TRACE_DEBUG(ANNOYING, "Calling next OUT callback on %p : %p (prio %d)", msgptr, rh->rt_out_cb, rh->prio);898 CHECK_FCT_DO( ret = (*rh->rt_out_cb)(rh->cbdata, msgptr, candidates),894 TRACE_DEBUG(ANNOYING, "Calling next OUT callback on %p : %p (prio %d)", *pmsg, rh->rt_out_cb, rh->prio); 895 CHECK_FCT_DO( ret = (*rh->rt_out_cb)(rh->cbdata, *pmsg, candidates), 899 896 { 900 fd_msg_log( FD_MSG_LOG_DROPPED, msgptr, "Internal error: an OUT routing callback returned an error (%s)", strerror(ret));901 fd_msg_free( msgptr);902 msgptr= NULL;897 fd_msg_log( FD_MSG_LOG_DROPPED, *pmsg, "Internal error: an OUT routing callback returned an error (%s)", strerror(ret)); 898 fd_msg_free(*pmsg); 899 *pmsg = NULL; 903 900 break; 904 901 } ); … … 909 906 910 907 /* If an error occurred, skip to the next message */ 911 if (! msgptr) {908 if (! *pmsg) { 912 909 if (rtd) 913 910 fd_rtd_free(&rtd); … … 920 917 921 918 /* Save the routing information in the message */ 922 CHECK_FCT( fd_msg_rt_associate ( msgptr, &rtd ) );919 CHECK_FCT( fd_msg_rt_associate ( *pmsg, &rtd ) ); 923 920 924 921 /* Now try sending the message */ … … 937 934 if (fd_peer_getstate(peer) == STATE_OPEN) { 938 935 /* Send to this one */ 939 CHECK_FCT_DO( fd_out_send( &msgptr, NULL, peer, 0), continue );936 CHECK_FCT_DO( fd_out_send(pmsg, NULL, peer, 0), continue ); 940 937 941 938 /* If the sending was successful */ … … 945 942 946 943 /* If the message has not been sent, return an error */ 947 if ( msgptr) {948 fd_msg_log( FD_MSG_LOG_NODELIVER, msgptr, "No suitable candidate to route the message to." );949 return_error( &msgptr, "DIAMETER_UNABLE_TO_DELIVER", "No suitable candidate to route the message to", NULL);944 if (*pmsg) { 945 fd_msg_log( FD_MSG_LOG_NODELIVER, *pmsg, "No suitable candidate to route the message to." ); 946 return_error( pmsg, "DIAMETER_UNABLE_TO_DELIVER", "No suitable candidate to route the message to", NULL); 950 947 } 951 948 … … 980 977 981 978 /* This is the common thread code (same for routing and dispatching) */ 982 static void * process_thr(void * arg, int (*action_cb)(struct msg * 979 static void * process_thr(void * arg, int (*action_cb)(struct msg ** pmsg), struct fifo * queue, char * action_name) 983 980 { 984 981 TRACE_ENTRY("%p %p %p %p", arg, action_cb, queue, action_name); … … 1043 1040 1044 1041 /* Now process the message */ 1045 CHECK_FCT_DO( (*action_cb)( msg), goto fatal_error);1042 CHECK_FCT_DO( (*action_cb)(&msg), goto fatal_error); 1046 1043 1047 1044 /* We're done with this message */
Note: See TracChangeset
for help on using the changeset viewer.