Navigation


Changeset 1154:0b95a3afbfc3 in freeDiameter for libfdcore


Ignore:
Timestamp:
May 27, 2013, 6:22:40 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Return DIAMETER_LOOP_DETECTED if local peer is already in the Route-Record AVP of a new received request.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/routing_dispatch.c

    r1127 r1154  
    588588                }
    589589
    590                 /* Parse the message for Dest-Host and Dest-Realm */
     590                /* Parse the message for Dest-Host, Dest-Realm, and Route-Record */
    591591                CHECK_FCT(  fd_msg_browse(msgptr, MSG_BRW_FIRST_CHILD, &avp, NULL)  );
    592592                while (avp) {
     
    664664                                                un_val = ahdr->avp_value;
    665665                                                break;
     666                                               
     667                                        case AC_ROUTE_RECORD:
     668                                                /* Parse this AVP */
     669                                                CHECK_FCT_DO( ret = fd_msg_parse_dict ( avp, fd_g_config->cnf_dict, &error_info ),
     670                                                        {
     671                                                                if (error_info.pei_errcode) {
     672                                                                        fd_hook_call(HOOK_MESSAGE_PARSING_ERROR, msgptr, NULL, error_info.pei_message ?: error_info.pei_errcode, fd_msg_pmdl_get(msgptr));
     673                                                                        CHECK_FCT( return_error( &msgptr, error_info.pei_errcode, error_info.pei_message, error_info.pei_avp) );
     674                                                                        return 0;
     675                                                                } else {
     676                                                                        fd_hook_call(HOOK_MESSAGE_PARSING_ERROR, msgptr, NULL, "Unspecified error while parsing Route-Record AVP", fd_msg_pmdl_get(msgptr));
     677                                                                        return ret;
     678                                                                }
     679                                                        } );
     680                                                ASSERT( ahdr->avp_value );
     681                                                /* Is this our own name ? */
     682                                                if (!fd_os_almostcasesrch(ahdr->avp_value->os.data, ahdr->avp_value->os.len, fd_g_config->cnf_diamid, fd_g_config->cnf_diamid_len, NULL)) {
     683                                                        /* Yes: then we must return DIAMETER_LOOP_DETECTED according to Diameter RFC */
     684                                                        char * error = "DIAMETER_LOOP_DETECTED";
     685                                                        fd_hook_call(HOOK_MESSAGE_PARSING_ERROR, msgptr, NULL, error, fd_msg_pmdl_get(msgptr));
     686                                                        CHECK_FCT( return_error( &msgptr, error, NULL, NULL) );
     687                                                        return 0;
     688                                                }
     689                                                break;
     690                                               
     691                                       
    666692                                }
    667693                        }
Note: See TracChangeset for help on using the changeset viewer.