# HG changeset patch # User Sebastien Decugis # Date 1387205736 -3600 # Node ID 4ad4d614acfadc31ba5776c174c2e7b2da6dfa89 # Parent c9a160b815ea4076ecef093cc8c788a296aa4635 Attempt to produce a CEA that is compliant with the ABNF when the Error bit is not set. Thanks Antonio Martinez for the report -- http://lists.freediameter.net/pipermail/dev/2013-December/000263.html diff -r c9a160b815ea -r 4ad4d614acfa libfdcore/p_ce.c --- a/libfdcore/p_ce.c Fri Nov 22 16:07:42 2013 +0100 +++ b/libfdcore/p_ce.c Mon Dec 16 15:55:36 2013 +0100 @@ -631,9 +631,19 @@ /* Reject an incoming connection attempt */ static void receiver_reject(struct cnxctx ** recv_cnx, struct msg ** cer, struct fd_pei * error) { + struct msg_hdr * hdr = NULL; + /* Create and send the CEA with appropriate error code */ CHECK_FCT_DO( fd_msg_new_answer_from_req ( fd_g_config->cnf_dict, cer, MSGFL_ANSW_ERROR ), goto destroy ); - CHECK_FCT_DO( fd_msg_rescode_set(*cer, error->pei_errcode, error->pei_message, error->pei_avp, 1 ), goto destroy ); + CHECK_FCT_DO( fd_msg_rescode_set(*cer, error->pei_errcode, error->pei_message, error->pei_avp, 0 ), goto destroy ); + CHECK_FCT_DO( fd_msg_hdr( *cer, &hdr ), goto destroy ); + if (hdr->msg_flags & CMD_FLAG_ERROR) { + /* Generic error format, just add the origin AVPs */ + CHECK_FCT_DO( fd_msg_add_origin ( *cer, 1 ), goto destroy ); + } else { + /* Add other AVPs to be compliant with the ABNF */ + CHECK_FCT_DO( add_CE_info(*cer, *recv_cnx, 0, 0), goto destroy ); + } CHECK_FCT_DO( fd_out_send(cer, *recv_cnx, NULL, 0), goto destroy ); if (error->pei_avp_free) {