# HG changeset patch # User Thomas Klausner # Date 1511792337 -3600 # Node ID afe0ecdb0692132e52ba6a078a50d6a4a00efb48 # Parent ae81cd81ab09fa35482295313f010d1cc78e4e27 Add config option if Route-Record AVPs should be added in Answers. Some software does not handle them correctly. diff -r ae81cd81ab09 -r afe0ecdb0692 doc/freediameter.conf.sample --- a/doc/freediameter.conf.sample Mon Nov 27 15:16:30 2017 +0100 +++ b/doc/freediameter.conf.sample Mon Nov 27 15:18:57 2017 +0100 @@ -250,3 +250,9 @@ ############################################################## +## General settings + +# If Route-Record AVPs should be added in Answers. +# Possible values: Always, Never +# Default: Always +#RouteRecordInAnswers = Never; diff -r ae81cd81ab09 -r afe0ecdb0692 include/freeDiameter/libfdcore.h --- a/include/freeDiameter/libfdcore.h Mon Nov 27 15:16:30 2017 +0100 +++ b/include/freeDiameter/libfdcore.h Mon Nov 27 15:18:57 2017 +0100 @@ -134,6 +134,7 @@ int cnf_thr_srv; /* Number of threads per servers handling the connection state machines */ struct fd_list cnf_apps; /* Applications locally supported (except relay, see flags). Use fd_disp_app_support to add one. list of struct fd_app. */ uint16_t cnf_dispthr; /* Number of dispatch threads to create */ + uint16_t cnf_rr_in_answers; /* include Route-Record AVP in answers */ struct { unsigned no_fwd : 1; /* the peer does not relay messages (0xffffff app id) */ unsigned no_ip4 : 1; /* disable IP */ diff -r ae81cd81ab09 -r afe0ecdb0692 libfdcore/config.c --- a/libfdcore/config.c Mon Nov 27 15:16:30 2017 +0100 +++ b/libfdcore/config.c Mon Nov 27 15:18:57 2017 +0100 @@ -67,6 +67,7 @@ #endif /* DISABLE_SCTP */ fd_g_config->cnf_orstateid = (uint32_t) time(NULL); + fd_g_config->cnf_rr_in_answers = 1; CHECK_FCT( fd_dict_init(&fd_g_config->cnf_dict) ); CHECK_FCT( fd_fifo_new(&fd_g_config->cnf_main_ev, 0) ); diff -r ae81cd81ab09 -r afe0ecdb0692 libfdcore/fdd.y --- a/libfdcore/fdd.y Mon Nov 27 15:16:30 2017 +0100 +++ b/libfdcore/fdd.y Mon Nov 27 15:18:57 2017 +0100 @@ -121,6 +121,9 @@ %token TLS_PRIO %token TLS_DH_BITS %token TLS_DH_FILE +%token RR_IN_ANSWERS +%token ALWAYS +%token NEVER /* -------------------------------------- */ @@ -153,6 +156,7 @@ | conffile tls_crl | conffile tls_prio | conffile tls_dh + | conffile rr_in_answers | conffile errors { yyerror(&yylloc, conf, "An error occurred while parsing the configuration file"); @@ -665,3 +669,16 @@ fclose(fd); } ; + +rr_values: ALWAYS + { + conf->cnf_rr_in_answers = 1; + } + | NEVER + { + conf->cnf_rr_in_answers = 0; + } + ; + +rr_in_answers: RR_IN_ANSWERS '=' rr_values ';' + ; diff -r ae81cd81ab09 -r afe0ecdb0692 libfdcore/p_psm.c --- a/libfdcore/p_psm.c Mon Nov 27 15:16:30 2017 +0100 +++ b/libfdcore/p_psm.c Mon Nov 27 15:18:57 2017 +0100 @@ -552,7 +552,9 @@ CHECK_FCT_DO( fd_p_expi_update(peer), goto psm_end ); /* Set the message source and add the Route-Record */ - CHECK_FCT_DO( fd_msg_source_setrr( msg, peer->p_hdr.info.pi_diamid, peer->p_hdr.info.pi_diamidlen, fd_g_config->cnf_dict ), goto psm_end); + if (fd_g_config->cnf_rr_in_answers || (hdr->msg_flags & CMD_FLAG_REQUEST)) { + CHECK_FCT_DO( fd_msg_source_setrr( msg, peer->p_hdr.info.pi_diamid, peer->p_hdr.info.pi_diamidlen, fd_g_config->cnf_dict ), goto psm_end); + } if ((hdr->msg_flags & CMD_FLAG_REQUEST)) { /* Mark the incoming request so that we know we have pending answers for this peer */