Navigation


Changeset 891:9432ac55823c in freeDiameter


Ignore:
Timestamp:
Nov 18, 2012, 7:28:50 AM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Tentative fix for the parse_or_error function

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • include/freeDiameter/libfdproto.h

    r871 r891  
    25242524struct fd_pei {
    25252525        char *          pei_errcode;    /* name of the error code to use */
    2526         struct avp *    pei_avp;        /* pointer to invalid or missing AVP (to be freed) */
     2526        struct avp *    pei_avp;        /* pointer to invalid (in original message) or missing AVP (to be freed) */
    25272527        char *          pei_message;    /* Overwrite default message if needed */
    25282528        int             pei_protoerr;   /* do we set the 'E' bit in the error message ? */
  • libfdcore/messages.c

    r837 r891  
    234234        /* Now add the optavp in a FailedAVP if provided */
    235235        if (optavp) {
     236                struct avp * optavp_cpy = NULL;
     237                struct avp_hdr *opt_hdr, *optcpy_hdr;
     238               
    236239                /* Create the Failed-AVP AVP */
    237240                CHECK_FCT( fd_msg_avp_new( dict_avp_FAVP, 0, &avp_FAVP ) );
    238 
     241               
     242                /* Create a new AVP with a copy of the data of the invalid or missing AVP */
     243                CHECK_FCT( fd_msg_avp_new( NULL, AVPFL_SET_BLANK_VALUE, &optavp_cpy) );
     244               
     245                CHECK_FCT( fd_msg_avp_hdr(optavp, &opt_hdr) );
     246                CHECK_FCT( fd_msg_avp_hdr(optavp_cpy, &optcpy_hdr) );
     247                memcpy(optcpy_hdr, opt_hdr, sizeof(struct avp_hdr));
     248               
    239249                /* Add the passed AVP inside it */
    240                 CHECK_FCT( fd_msg_avp_add( avp_FAVP, MSG_BRW_LAST_CHILD, optavp ) );
     250                CHECK_FCT( fd_msg_avp_add( avp_FAVP, MSG_BRW_LAST_CHILD, optavp_cpy ) );
    241251               
    242252                /* And add to the message */
  • libfdproto/messages.c

    r889 r891  
    17791779                        error_info->pei_message = error_message;
    17801780                }
     1781                avp->avp_model = NULL;
    17811782                return EBADMSG;
    17821783        }
  • tests/testmesg.c

    r890 r891  
    767767                                CHECK( EBADMSG, fd_msg_parse_or_error( &msg ) );
    768768                               
    769                                 /* Check the Failed-AVP is as expected */
     769                                TODO("Check the Failed-AVP is as expected");
    770770                               
    771771                                fd_msg_dump_walk(0, msg);
     
    773773                                /* reset */
    774774                                CHECK( 0, fd_msg_free ( msg ) );
    775                                
    776                                 ASSERT(0);
    777775                        }
    778776#endif                 
Note: See TracChangeset for help on using the changeset viewer.