It is unlikely that this patch solves any eventual issues that you had.
You changed the comparison of a pointer with NULL to 0 and, in C, NULL and 0 are the same in context of pointers:
- https://c-faq.com/null/nullor0.html
So practically there is not change in behaviour.
Cheers, Daniel
On 21.12.22 15:41, Olle E. Johansson wrote:
I suggest that this patch be backported :-)
Cheers, /O
Begin forwarded message:
*From: *Olle E. Johansson oej@edvina.net *Subject: **[sr-dev] git:master:5c90e6e2: DMQ: dmq_notification_address_list is initialized to NULL* *Date: *21 December 2022 at 15:27:49 CET *To: *sr-dev@lists.kamailio.org *Reply-To: *"Kamailio (SER) - Development Mailing List" sr-dev@lists.kamailio.org
Module: kamailio Branch: master Commit: 5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb URL: https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6...
Author: Olle E. Johansson oej@edvina.net Committer: Olle E. Johansson oej@edvina.net Date: 2022-12-21T15:27:28+01:00
DMQ: dmq_notification_address_list is initialized to NULL
This code led to random and unpredictable behaviour when loading a configuration with multiple notification nodes.
Modified: src/modules/dmq/dmq.c
Diff: https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6... Patch: https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6...
diff --git a/src/modules/dmq/dmq.c b/src/modules/dmq/dmq.c index 843b7e3e4d2..f4a66c3d847 100644 --- a/src/modules/dmq/dmq.c +++ b/src/modules/dmq/dmq.c @@ -379,7 +379,7 @@ static int dmq_add_notification_address(modparam_t type, void * val) }
/* initial allocation */ -if (dmq_notification_address_list == 0) { +if (dmq_notification_address_list == NULL) { dmq_notification_address_list = pkg_malloc(sizeof(str_list_t)); if (dmq_notification_address_list == NULL) { PKG_MEM_ERROR;
Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-leave@lists.kamailio.org
On 21 Dec 2022, at 15:54, Daniel-Constantin Mierla miconda@gmail.com wrote:
It is unlikely that this patch solves any eventual issues that you had.
You changed the comparison of a pointer with NULL to 0 and, in C, NULL and 0 are the same in context of pointers:
So practically there is not change in behaviour.
Ok, so the change for better was still random. Oh well, it looks better to compare with the same value that we initialized with so I guess it doesn’t harm.
We have problems with getting DMQ initializing properly with four notification nodes. Kamailio doesn’t load all of them at start. We get very random behaviour.
Debugging continues :-)… Who cares about holidays when you have an interesting problem at hand? :-) I’ll create a local branch and add even more debugging.
/O
Cheers, Daniel
On 21.12.22 15:41, Olle E. Johansson wrote:
I suggest that this patch be backported :-)
Cheers, /O
Begin forwarded message:
From: Olle E. Johansson <oej@edvina.net mailto:oej@edvina.net> Subject: [sr-dev] git:master:5c90e6e2 git:master:5c90e6e2: DMQ: dmq_notification_address_list is initialized to NULL Date: 21 December 2022 at 15:27:49 CET To: sr-dev@lists.kamailio.org mailto:sr-dev@lists.kamailio.org Reply-To: "Kamailio (SER) - Development Mailing List" <sr-dev@lists.kamailio.org mailto:sr-dev@lists.kamailio.org>
Module: kamailio Branch: master Commit: 5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb URL: https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6... https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb
Author: Olle E. Johansson <oej@edvina.net mailto:oej@edvina.net> Committer: Olle E. Johansson <oej@edvina.net mailto:oej@edvina.net> Date: 2022-12-21T15:27:28+01:00
DMQ: dmq_notification_address_list is initialized to NULL
This code led to random and unpredictable behaviour when loading a configuration with multiple notification nodes.
Modified: src/modules/dmq/dmq.c
Diff: https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6... https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb.diff Patch: https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6... https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb.patch
diff --git a/src/modules/dmq/dmq.c b/src/modules/dmq/dmq.c index 843b7e3e4d2..f4a66c3d847 100644 --- a/src/modules/dmq/dmq.c +++ b/src/modules/dmq/dmq.c @@ -379,7 +379,7 @@ static int dmq_add_notification_address(modparam_t type, void * val) }
/* initial allocation */
- if (dmq_notification_address_list == 0) {
- if (dmq_notification_address_list == NULL) { dmq_notification_address_list = pkg_malloc(sizeof(str_list_t)); if (dmq_notification_address_list == NULL) { PKG_MEM_ERROR;
Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-leave@lists.kamailio.org mailto:sr-dev-leave@lists.kamailio.org
-- Daniel-Constantin Mierla -- www.asipto.com http://www.asipto.com/ www.twitter.com/miconda http://www.twitter.com/miconda -- www.linkedin.com/in/miconda http://www.linkedin.com/in/miconda