Navigation


Changeset 1250:446683efbb1f in freeDiameter for libfdcore


Ignore:
Timestamp:
Jan 13, 2014, 12:01:21 AM (10 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Children:
1251:bdd7bf840c8d, 1253:3734341ad03b
Phase:
public
Message:

Attempt fix for Failed-AVP created with a Grouped AVP, in that case we want an empty AVP by default, not a blank AVP of the same length

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/messages.c

    r1230 r1250  
    239239                struct avp * optavp_cpy = NULL;
    240240                struct avp_hdr *opt_hdr, *optcpy_hdr;
     241                struct dict_object * opt_model = NULL;
     242                int is_grouped = 0;
    241243               
    242244                /* Create the Failed-AVP AVP */
    243245                CHECK_FCT( fd_msg_avp_new( dict_avp_FAVP, 0, &avp_FAVP ) );
    244246               
     247                /* Was this AVP a grouped one? Best effort only here */
     248                if (!fd_msg_model ( optavp, &opt_model ) && (opt_model != NULL)) {
     249                        struct dict_avp_data  dictdata;
     250                        CHECK_FCT(  fd_dict_getval(opt_model, &dictdata)  );
     251                        if (dictdata.avp_basetype == AVP_TYPE_GROUPED)
     252                                is_grouped = 1;
     253                }
     254               
    245255                /* Create a new AVP with a copy of the data of the invalid or missing AVP */
    246256                optavp_cpy = optavp;
    247                 CHECK_FCT( fd_msg_avp_new( NULL, AVPFL_SET_BLANK_VALUE | AVPFL_SET_RAWDATA_FROM_AVP, &optavp_cpy) );
    248                
    249                 CHECK_FCT( fd_msg_avp_hdr(optavp, &opt_hdr) );
    250                 CHECK_FCT( fd_msg_avp_hdr(optavp_cpy, &optcpy_hdr) );
    251                 memcpy(optcpy_hdr, opt_hdr, sizeof(struct avp_hdr));
     257               
     258                if (is_grouped) {
     259                        CHECK_FCT( fd_msg_avp_new( opt_model, 0, &optavp_cpy) );
     260                } else {
     261                        CHECK_FCT( fd_msg_avp_new( NULL, AVPFL_SET_BLANK_VALUE | AVPFL_SET_RAWDATA_FROM_AVP, &optavp_cpy) );
     262               
     263                        CHECK_FCT( fd_msg_avp_hdr(optavp, &opt_hdr) );
     264                        CHECK_FCT( fd_msg_avp_hdr(optavp_cpy, &optcpy_hdr) );
     265                        memcpy(optcpy_hdr, opt_hdr, sizeof(struct avp_hdr));
     266                }
    252267               
    253268                /* Add the passed AVP inside it */
Note: See TracChangeset for help on using the changeset viewer.