Skip to content

Commit

Permalink
SIP PN: Prevent overlapping modifications of pn_ebr_filters template
Browse files Browse the repository at this point in the history
The @pn_ebr_filters templates are actually allocated in shared memory and
can be modified by multiple SIP workers concurrently, leading to
occasional strange routing of INVITEs.  The fix is to simply allocate
the objects in private memory instead.

Credits to Ondrej Jirman <[email protected]> for documenting, troubleshooting
and providing an initial fix!

Related to #3394
  • Loading branch information
liviuchircu committed Aug 28, 2024
1 parent 8e93d08 commit 078e65b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/reg/pn.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ int pn_init(void)
param->s.len, param->s.s);

/* build the filter templates, values are to be filled in at runtime */
filter = shm_malloc(sizeof *filter);
filter = pkg_malloc(sizeof *filter);
if (!filter) {
LM_ERR("oom\n");
return -1;
Expand Down Expand Up @@ -161,7 +161,7 @@ int pn_init(void)
return -1;
}

provider = shm_malloc(sizeof *provider + pnp->s.len + 1 +
provider = pkg_malloc(sizeof *provider + pnp->s.len + 1 +
MAX_FEATURE_CAPS_SIZE);
if (!provider) {
LM_ERR("oom\n");
Expand Down

0 comments on commit 078e65b

Please sign in to comment.