From 7ca1c47faa4779c851f44ab1604a73605ed43aff Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Wed, 15 Feb 2023 18:02:22 +0100 Subject: [PATCH] MT#56097 dialog: deactivate print_list Change-Id: Id3b5c73f016fa78cff1aa72dce6e1ce71619fb3b (cherry picked from commit 7b8dafd0e3a4ea44ba8253f950bd2afd7d3e5851) (cherry picked from commit ddd257deb1c9730b0eb87ed94481c6f9c44cec45) (cherry picked from commit 576f27d503dc81ac7a24cb75e728bef6ecd45d6f) --- debian/patches/series | 1 + ...lg_set_var-support-empty-totag-param.patch | 6 +- ...rt-profile_get_size-for-all-profiles.patch | 14 +-- ...e-print-variable-function-which-is-o.patch | 117 ++++++++++++++++++ 4 files changed, 128 insertions(+), 10 deletions(-) create mode 100644 debian/patches/upstream/dialog-deactivate-print-variable-function-which-is-o.patch diff --git a/debian/patches/series b/debian/patches/series index fd16578bf..659fbd15c 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -42,6 +42,7 @@ upstream/dialog-dlg_get_var-assure-return-null-on-error.patch upstream/dialog-w_dlg_get_var-fix-incompatible-pointer.patch sipwise/dialog-dlg_get_var-changes-in-API.patch upstream/presence-No-autocommit-rollback-if-no-active-watcher.patch +upstream/dialog-deactivate-print-variable-function-which-is-o.patch ### relevant for upstream sipwise/pua_dialoginfo-refresh_pubruri_avps_flag.patch sipwise/pua_dialoginfo-use-lock-when-use_puburi_avps-is-set.patch diff --git a/debian/patches/sipwise/dialog-dlg_set_var-support-empty-totag-param.patch b/debian/patches/sipwise/dialog-dlg_set_var-support-empty-totag-param.patch index 597bf5c72..c6d1bc71d 100644 --- a/debian/patches/sipwise/dialog-dlg_set_var-support-empty-totag-param.patch +++ b/debian/patches/sipwise/dialog-dlg_set_var-support-empty-totag-param.patch @@ -8,10 +8,10 @@ Subject: MT#55631 dialog: dlg_set_var() support empty totag parameter 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c -index aedf8a7..8f4c806 100644 +index 4ecc858..fe07899 100644 --- a/src/modules/dialog/dialog.c +++ b/src/modules/dialog/dialog.c -@@ -1663,7 +1663,7 @@ static int ki_dlg_set_var(sip_msg_t *msg, str *sc, str *sf, str *st, str *key, s +@@ -1666,7 +1666,7 @@ static int ki_dlg_set_var(sip_msg_t *msg, str *sc, str *sf, str *st, str *key, s LM_ERR("invalid From tag parameter\n"); return -1; } @@ -20,7 +20,7 @@ index aedf8a7..8f4c806 100644 LM_ERR("invalid To tag parameter\n"); return -1; } -@@ -1707,11 +1707,7 @@ static int w_dlg_set_var(struct sip_msg *msg, char *ci, char *ft, char *tt, char +@@ -1710,11 +1710,7 @@ static int w_dlg_set_var(struct sip_msg *msg, char *ci, char *ft, char *tt, char LM_ERR("unable to get To Tag\n"); return -1; } diff --git a/debian/patches/sipwise/dialog-support-profile_get_size-for-all-profiles.patch b/debian/patches/sipwise/dialog-support-profile_get_size-for-all-profiles.patch index dfd8e0d1d..9fcb34853 100644 --- a/debian/patches/sipwise/dialog-support-profile_get_size-for-all-profiles.patch +++ b/debian/patches/sipwise/dialog-support-profile_get_size-for-all-profiles.patch @@ -10,10 +10,10 @@ Subject: dialog: support profile_get_size for all profiles 4 files changed, 70 insertions(+) diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c -index 25f3ca1..aedf8a7 100644 +index 49888ec..4ecc858 100644 --- a/src/modules/dialog/dialog.c +++ b/src/modules/dialog/dialog.c -@@ -2758,6 +2758,33 @@ static void internal_rpc_profile_get_size(rpc_t *rpc, void *c, str *profile_name +@@ -2761,6 +2761,33 @@ static void internal_rpc_profile_get_size(rpc_t *rpc, void *c, str *profile_name return; } @@ -47,7 +47,7 @@ index 25f3ca1..aedf8a7 100644 /*! * \brief Helper function that outputs the dialogs belonging to a given profile via the RPC interface * \see rpc_profile_print_dlgs -@@ -2850,6 +2877,9 @@ static const char *rpc_dlg_set_state_doc[3] = { +@@ -2853,6 +2880,9 @@ static const char *rpc_dlg_set_state_doc[3] = { static const char *rpc_profile_get_size_doc[2] = { "Returns the number of dialogs belonging to a profile", 0 }; @@ -57,7 +57,7 @@ index 25f3ca1..aedf8a7 100644 static const char *rpc_profile_print_dlgs_doc[2] = { "Lists all the dialogs belonging to a profile", 0 }; -@@ -3055,6 +3085,10 @@ static void rpc_profile_get_size(rpc_t *rpc, void *c) { +@@ -3058,6 +3088,10 @@ static void rpc_profile_get_size(rpc_t *rpc, void *c) { } return; } @@ -68,7 +68,7 @@ index 25f3ca1..aedf8a7 100644 static void rpc_profile_print_dlgs(rpc_t *rpc, void *c) { str profile_name = {NULL,0}; str value = {NULL,0}; -@@ -3472,6 +3506,7 @@ static rpc_export_t rpc_methods[] = { +@@ -3475,6 +3509,7 @@ static rpc_export_t rpc_methods[] = { {"dlg.dlg_list_ctx", rpc_print_dlg_ctx, rpc_print_dlg_ctx_doc, 0}, {"dlg.end_dlg", rpc_end_dlg_entry_id, rpc_end_dlg_entry_id_doc, 0}, {"dlg.profile_get_size", rpc_profile_get_size, rpc_profile_get_size_doc, 0}, @@ -112,10 +112,10 @@ index 3dc7be8..7a4f8b0 100644 /*! * \brief Search a dialog profile in the global list diff --git a/src/modules/dialog/doc/dialog_admin.xml b/src/modules/dialog/doc/dialog_admin.xml -index 6fcaaf7..906151d 100644 +index 185c53a..45be914 100644 --- a/src/modules/dialog/doc/dialog_admin.xml +++ b/src/modules/dialog/doc/dialog_admin.xml -@@ -2856,6 +2856,28 @@ dlg_reset_property("timeout-noreset"); +@@ -2877,6 +2877,28 @@ dlg_reset_property("timeout-noreset"); diff --git a/debian/patches/upstream/dialog-deactivate-print-variable-function-which-is-o.patch b/debian/patches/upstream/dialog-deactivate-print-variable-function-which-is-o.patch new file mode 100644 index 000000000..b2e5b6f35 --- /dev/null +++ b/debian/patches/upstream/dialog-deactivate-print-variable-function-which-is-o.patch @@ -0,0 +1,117 @@ +From: Henning Westerholt +Date: Wed, 16 Nov 2022 15:33:06 +0000 +Subject: dialog: deactivate print variable function which is only used for + debugging + +- deactivate print variable function which is only used for debugging +- this function is not good for performance and might also cause race conditions +--- + src/modules/dialog/dialog.c | 3 +++ + src/modules/dialog/dlg_var.c | 12 +++++++++--- + src/modules/dialog/dlg_var.h | 2 ++ + src/modules/dialog/doc/dialog_admin.xml | 21 +++++++++++++++++++++ + 4 files changed, 35 insertions(+), 3 deletions(-) + +diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c +index 25f3ca1..49888ec 100644 +--- a/src/modules/dialog/dialog.c ++++ b/src/modules/dialog/dialog.c +@@ -141,6 +141,8 @@ stat_var *expired_dlgs = 0; + stat_var *failed_dlgs = 0; + stat_var *early_dlgs = 0; + ++int debug_variables_list = 0; ++ + struct tm_binds d_tmb; + struct rr_binds d_rrb; + pv_spec_t timeout_avp; +@@ -338,6 +340,7 @@ static param_export_t mod_params[]={ + { "h_id_step", PARAM_INT, &dlg_h_id_step }, + { "keep_proxy_rr", INT_PARAM, &dlg_keep_proxy_rr }, + { "dlg_filter_mode", INT_PARAM, &dlg_filter_mode }, ++ { "debug_variables", PARAM_INT, &debug_variables_list }, + { 0,0,0 } + }; + +diff --git a/src/modules/dialog/dlg_var.c b/src/modules/dialog/dlg_var.c +index 473736b..0e165c5 100644 +--- a/src/modules/dialog/dlg_var.c ++++ b/src/modules/dialog/dlg_var.c +@@ -449,7 +449,9 @@ int set_dlg_variable(struct dlg_cell *dlg, str *key, str *val) + if ( dlg_db_mode==DB_MODE_REALTIME ) + update_dialog_dbinfo(dlg); + +- print_lists(dlg); ++ if(unlikely(debug_variables_list)) { ++ print_lists(dlg); ++ } + + return 0; + +@@ -510,7 +512,9 @@ int pv_get_dlg_variable(struct sip_msg *msg, pv_param_t *param, pv_value_t *res) + } + } + +- print_lists(dlg); ++ if(unlikely(debug_variables_list)) { ++ print_lists(dlg); ++ } + + /* unlock dialog */ + if (dlg) { +@@ -584,7 +588,9 @@ int pv_set_dlg_variable(struct sip_msg* msg, pv_param_t *param, int op, pv_value + } + dlg_unlock(d_table, &(d_table->entries[dlg->h_entry])); + } +- print_lists(dlg); ++ if(unlikely(debug_variables_list)) { ++ print_lists(dlg); ++ } + + dlg_release(dlg); + return 0; +diff --git a/src/modules/dialog/dlg_var.h b/src/modules/dialog/dlg_var.h +index 292e9f7..44bd6ec 100644 +--- a/src/modules/dialog/dlg_var.h ++++ b/src/modules/dialog/dlg_var.h +@@ -89,6 +89,8 @@ extern stat_var *processed_dlgs; /*!< number of processed dialogs */ + extern stat_var *expired_dlgs; /*!< number of expired dialogs */ + extern stat_var *failed_dlgs; /*!< number of failed dialogs */ + ++extern int debug_variables_list; ++ + int pv_get_dlg_ctx(sip_msg_t *msg, pv_param_t *param, + pv_value_t *res); + int pv_set_dlg_ctx(sip_msg_t *msg, pv_param_t *param, +diff --git a/src/modules/dialog/doc/dialog_admin.xml b/src/modules/dialog/doc/dialog_admin.xml +index 6fcaaf7..185c53a 100644 +--- a/src/modules/dialog/doc/dialog_admin.xml ++++ b/src/modules/dialog/doc/dialog_admin.xml +@@ -1663,6 +1663,27 @@ modparam("dialog", "h_id_step", 10) + ... + modparam("dialog", "keep_proxy_rr", 1) + ... ++ ++ ++ ++
++ <varname>debug_variables</varname> (int) ++ ++ Activate additional debugging for printing internal lists for dialog variables. ++ This output is only visible at debug log level and should only be used for ++ debugging. By default its deactivated. ++ ++ ++ ++ Default value is 0. ++ ++ ++ ++ Set <varname>debug_variables</varname> parameter ++ ++... ++modparam("dialog", "debug_variables", 1) ++... + + +