Skip to content

Conversation

@benceszigeti
Copy link
Collaborator

No description provided.

opensips-github and others added 30 commits July 27, 2025 02:11
This prevents a crash running the child_init in the same time with a reload

Many thanks go to ConnexCS for reporting and testing the fix!

(cherry picked from commit ab3ffa1)
Per documentation: "To be more specific, the only runtime table we have
so far is the "cc_calls" table."

(cherry picked from commit 69ad46c)
The package distutils was deprecated in Python 3.10 and removed in 3.12.
Let's switch to modern alternative. Also remove one extra shell call.

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
(cherry picked from commit 5a986df)
Fix various function or variable type mismatch

(cherry picked from commit be32aca)
It is possible that we can jump to `error` where we free `nt_name` right
before initialization. So better to initialize it first.

```
Compiling app_opensips/avps.c
gcc -fPIC -DPIC -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -DMOD_NAME='aaa_diameter' -DPKG_MALLOC  -DSHM_MMAP  -DUSE_MCAST  -DDISABLE_NAGLE  -DSTATISTICS  -DHAVE_RESOLV_RES  -DF_MALLOC  -DQ_MALLOC  -DHP_MALLOC  -DDBG_MALLOC  -DF_PARALLEL_MALLOC  -DHAVE_STDATOMIC -DHAVE_GENERICS  -DNAME='"opensips"' -DVERSION='"3.6.0"' -DARCH='"x86_64"' -DOS='"linux"' -DCOMPILER='"gcc 15"' -D__CPU_x86_64 -D__OS_linux -D__SMP_yes -DCFG_DIR='"/etc/opensips/"'  -DVERSIONTYPE='"git"' -DTHISREVISION='"07da80880"' -DFAST_LOCK -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H -DHAVE_TIMEGM -DHAVE_EPOLL -DHAVE_SIGIO_RT -DHAVE_SELECT -c app_opensips/avps.c -o app_opensips/avps.o
app_opensips/avps.c: In function ‘parse_attr_def’:
app_opensips/avps.c:732:9: warning: ‘nt_name’ may be used uninitialized [-Wmaybe-uninitialized]
  732 |         free(nt_name);
      |         ^~~~~~~~~~~~~
app_opensips/avps.c:564:22: note: ‘nt_name’ was declared here
  564 |         char *name, *nt_name, *newp, *p = line, *end = p + len;
      |                      ^~~~~~~
```

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
(cherry picked from commit 233769b)
Variable `old_state` can be used w/o being initialized. This patch fixed
it.

```
Compiling sharing_tags.c
gcc -fPIC -DPIC -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -DMOD_NAME='clusterer' -DPKG_MALLOC  -DSHM_MMAP  -DUSE_MCAST  -DDISABLE_NAGLE  -DSTATISTICS  -DHAVE_RESOLV_RES  -DF_MALLOC  -DQ_MALLOC  -DHP_MALLOC  -DDBG_MALLOC  -DF_PARALLEL_MALLOC  -DHAVE_STDATOMIC -DHAVE_GENERICS  -DNAME='"opensips"' -DVERSION='"3.6.0"' -DARCH='"x86_64"' -DOS='"linux"' -DCOMPILER='"gcc 15"' -D__CPU_x86_64 -D__OS_linux -D__SMP_yes -DCFG_DIR='"/etc/opensips/"'  -DVERSIONTYPE='"git"' -DTHISREVISION='"07da80880"' -DFAST_LOCK -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H -DHAVE_TIMEGM -DHAVE_EPOLL -DHAVE_SIGIO_RT -DHAVE_SELECT -c sharing_tags.c -o sharing_tags.o
sharing_tags.c: In function ‘shtag_activate’:
sharing_tags.c:746:49: warning: ‘old_state’ may be used uninitialized [-Wmaybe-uninitialized]
  746 |         if (ret==SHTAG_STATE_ACTIVE && old_state!=SHTAG_STATE_ACTIVE) {
sharing_tags.c:685:18: note: ‘old_state’ was declared here
  685 |         int ret, old_state;
      |                  ^~~~~~~~~
```

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
(cherry picked from commit 1c31a68)
GCC erroneously believes that `job_data` may be used uninitialized.
Let's help him understand the situation better.

```
Compiling kafka_producer.c
gcc -fPIC -DPIC -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -DMOD_NAME='event_kafka' -DPKG_MALLOC  -DSHM_MMAP  -DUSE_MCAST  -DDISABLE_NAGLE  -DSTATISTICS  -DHAVE_RESOLV_RES  -DF_MALLOC  -DQ_MALLOC  -DHP_MALLOC  -DDBG_MALLOC  -DF_PARALLEL_MALLOC  -DHAVE_STDATOMIC -DHAVE_GENERICS  -DNAME='"opensips"' -DVERSION='"3.6.0"' -DARCH='"x86_64"' -DOS='"linux"' -DCOMPILER='"gcc 15"' -D__CPU_x86_64 -D__OS_linux -D__SMP_yes -DCFG_DIR='"/etc/opensips/"'  -DVERSIONTYPE='"git"' -DTHISREVISION='"07da80880"' -DFAST_LOCK -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H -DHAVE_TIMEGM -DHAVE_EPOLL -DHAVE_SIGIO_RT -DHAVE_SELECT -DWITH_GZFILEOP -c kafka_producer.c -o kafka_producer.o
kafka_producer.c: In function ‘kafka_report_status’:
kafka_producer.c:422:57: warning: ‘job_data’ may be used uninitialized [-Wmaybe-uninitialized]
  422 |         if (p->job->type == KAFKA_JOB_SCRIPT && job_data->report_rt)
      |                                                 ~~~~~~~~^~~~~~~~~~~
kafka_producer.c:382:28: note: ‘job_data’ was declared here
  382 |         script_job_data_t *job_data;
      |                            ^~~~~~~~
```

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
(cherry picked from commit 9472e64)
GCC erroneously believes that `hdrs` may be used uninitialized. Let's
help him understand the situation better.

```
Compiling http2d.c
gcc -fPIC -DPIC -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -DMOD_NAME='http2d' -DPKG_MALLOC  -DSHM_MMAP  -DUSE_MCAST  -DDISABLE_NAGLE  -DSTATISTICS  -DHAVE_RESOLV_RES  -DF_MALLOC  -DQ_MALLOC  -DHP_MALLOC  -DDBG_MALLOC  -DF_PARALLEL_MALLOC  -DHAVE_STDATOMIC -DHAVE_GENERICS  -DNAME='"opensips"' -DVERSION='"3.6.0"' -DARCH='"x86_64"' -DOS='"linux"' -DCOMPILER='"gcc 15"' -D__CPU_x86_64 -D__OS_linux -D__SMP_yes -DCFG_DIR='"/etc/opensips/"'  -DVERSIONTYPE='"git"' -DTHISREVISION='"07da80880"' -DFAST_LOCK -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H -DHAVE_TIMEGM -DHAVE_EPOLL -DHAVE_SIGIO_RT -DHAVE_SELECT -I/usr/include -c http2d.c -o http2d.o
http2d.c: In function ‘h2_send_response’:
http2d.c:267:25: warning: ‘hdrs’ may be used uninitialized [-Wmaybe-uninitialized]
  267 |                 for (it = hdrs->child; it; it = it->next, nh++, r->hdrs_len++) {
      |                      ~~~^~~~~~~~~~~~~
http2d.c:138:16: note: ‘hdrs’ was declared here
  138 |         cJSON *hdrs, *it;
      |                ^~~~
```

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
(cherry picked from commit 19e2fac)
Completes OpenSIPS#3690

(cherry picked from commit c25a8ff)
Many thanks to Nuno Ferreira from Five9 for spotting, reporting and
fixing this.

(cherry picked from commit cc11d0a)
When an update command is received, the dialog is searched: before this
commit, if the dialog was not found, `dlg` was returned as `null`, and a
new dialog, **with the same coordinates** was created.
This commit makes sure that the dialog is no longer created if already
in deleted state, thus avoiding creating the dialog multiple times with
the same coordinates.
The "$sdp = NULL;" statement wasn't fully working as expected, as
subsequent operations would still pick up some left-over SDP data.

(cherry picked from commit 020ea0d)
OpenSIPS no longer throws an error on SDP bodies with missing
line-termination sequence on the very last line.  According to SDP ABNF
specs, this is bad syntax, but we accept it and move on.

Moreover, assuming the SDP is dirty (at least one edit), the output SDP
($sdp) will always be normalized to include the ending LF sequence.

(cherry picked from commit 20b0ba8)
Make sure we are not trying to access the RTP context that has been
destroyed along with the dialog moving in state 5.

(cherry picked from commit bbfa2b0)
Also, fix top-level rc from "-1" (invalid user? continue script?) into
"0" (auto-reply SIP 500 error! halt script!) on such scripting errors.

Fixes OpenSIPS#3756

(cherry picked from commit dfd616b)
@davidtrihy-genesys
Copy link
Collaborator

My sipmsg_validate and contact header dialog fix have been merged upstream with slight changes so if you could pull those in and defer to the new changes before merging.

There's also the issue of the rest client updates that can cause the client to behave in a synchronous manner which will probable cause even more issue with internal TLS on here is the line I've identified as the main culprit https://github.com/purecloudlabs/opensips/blob/master/modules/rest_client/rest_methods.c#L976C25-L976C32

The issue seems to be it thinks that the request has already been serviced so it goes into a synchronous mode which is desired behaviour if that is the case but in the scenario where this happens it's not actually ready to download the body and it blocks

The offending line is here https://github.com/purecloudlabs/opensips/blob/master/modules/rest_client/rest_methods.c#L910C29-L910C50 where req_sz can be 0 before the actual request has been serviced I think I have a potential fix for it without merging in my big PR changes which could be risky

@benceszigeti
Copy link
Collaborator Author

@davidtrihy-genesys

Rebased, dropped the following commits to get in sync with 3.6.3 instead of 3.6.x:

d b1dd39c11 GitHub Workflows:  Run rtp.io build tests only on `master`
d 288bdfa93 Rebuild documentation
d 76b7fa7a0 b2b_logic: also replicate in_sdp for created entity
d e78b3e99a Rebuild documentation
d a4cbe17b2 Fix reply relaying after launch() from onreply_route
d e65c54580 b2b_entities: Zero DB handles after module destroy
d aa4ddd17b [TCP] fixed bad handling upon "max async postponed chunks"

Cherry-picked:

Not going to merge it yet, will fix our scripts first and run tests on DCA.

@benceszigeti
Copy link
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

upstream merge Upstream merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.