<!-- Kamailio Pull Request Template -->
Topos: Added get_callid_mask functin which will give the masked callID if actual callID is given and get_callid_unmask function which will unmask the given call-ID. This funtion is useful when the client sends a refer methord with refer-to header containing call-id
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [x] Commit message has the format required by CONTRIBUTING guide
- [x] Commits are split per component (core, individual modules, libs, utils, ...)
- [x] Each component has a single commit (if not, squash them into one commit)
- [x] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [ ] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3872
-- Commit Summary --
* add funtion to mask/unmask callID
* get_callid_mask /get_callid_unmask Document Update
-- File Changes --
M src/modules/topos/doc/topos_admin.xml (87)
M src/modules/topos/topos_mod.c (183)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3872.patchhttps://github.com/kamailio/kamailio/pull/3872.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3872
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3872(a)github.com>
### Description
I used sip_p_charging_vector() function of siputils with flag f (remove + generate).
This function works fine if call is received without a P-Charging-Vector and only generate needs to be done.
But if the INVITE already contains a P-Charging-Vector and this vector needs to be removed and replaced by a new generated P-Charging-Vector the output is messed up.
The sip_p_charging_vector() function with flag r (remove) works fine too. P-Charging-Vector is removed if INVITE contains one. So for me this looks like an issue with the combination of remove + generate.
See SIP Traffic attached. The "old" P-Charging-Vector is not deleted and additionaly instead of a new P-Charging-Vector the "old" P-Charging-Vector is added again above SDP. Also some part of the next line "Session-Exp" is added and "TH: dih".
-----
TH: dih
icid-value=0d702d06-5700-103e-00-00-00-10-6b-03-dd-04;icid-generated-at=213.xxx.xxx.xxx
Session-Exp
-----
### Troubleshooting
#### Reproduction
It looks like the issue is triggered always a p-charging-vector is received by kamailio and sip_p_charging_vector() with flag f is called.
#### Log Messages
<!--
Check the syslog file and if there are relevant log messages printed by Kamailio, add them next, or attach to issue, or provide a link to download them (e.g., to a pastebin site).
-->
```
(paste your log messages here)
```
#### SIP Traffic
```
**This message is received by kamailio (Incoming):**
INVITE sip:+49xxxxxxxx;npdi;rn=+49xxxxxxxx@bob.com:5060;user=phone SIP/2.0
Via: SIP/2.0/UDP 213.xxx.xxx.xxx:5060;branch=z9hG4bK08Bf3722bac16f3e05b
From: <sip:+43xxxxxxxx@alice.com;user=phone>;tag=gK085abca7
To: <sip:+49xxxxxxxx0@92.xxx.xxx.xxx:5060;user=phone>
Call-ID: 168341746_132086108(a)213.xxx.xxx.xxx
CSeq: 373279 INVITE
Max-Forwards: 67
Allow: INVITE,ACK,CANCEL,BYE,REGISTER,REFER,INFO,SUBSCRIBE,NOTIFY,PRACK,UPDATE,OPTIONS,MESSAGE,PUBLISH
Accept: application/sdp, application/isup, application/dtmf, application/dtmf-relay, multipart/mixed
Contact: <sip:+43xxxxxxxx@213.xxx.xxx.xxx:5060>
P-Asserted-Identity: <sip:+43xxxxxxxx@alice.com:5060;user=phone>
Supported: timer,100rel,histinfo
P-Charging-Vector: icid-value=0d702d06-5700-103e-00-00-00-10-6b-03-dd-04;icid-generated-at=213.xxx.xxx.xxx
Session-Expires: 1800
Min-SE: 90
Content-Length: 236
Content-Disposition: session; handling=required
Content-Type: application/sdp
v=0
o=Sonus_UAC 278609 22801 IN IP4 213.xxx.xxx.xxx
s=SIP Media Capabilities
c=IN IP4 213.xxx.xxx.xxx
t=0 0
m=audio 29020 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=ptime:20
**This message is send out by kamailio (outgoing):**
INVITE sip:+49xxxxxxxx;npdi;rn=+49xxxxxxxx@bob.com:5060;user=phone SIP/2.0
Record-Route: <sip:172.xxx.xxx.xxx;r2=on;lr=on;ftag=gK085abca7>
Record-Route: <sip:92.xxx.xxx.xxx9;r2=on;lr=on;ftag=gK085abca7>
Via: SIP/2.0/UDP 172.xxx.xxx.xxx;branch=z9hG4bKc451.940fa2c220f96c1ef968de3c156db262.0
Via: SIP/2.0/UDP 213.xxx.xxx.xxx:5060;TH=div;branch=z9hG4bK08Bf3722bac16f3e05b
From: <sip:+43xxxxxxxx@alice.com;user=phone>;tag=gK085abca7
To: <sip:+49xxxxxxxx@92.xxx.xxx.xxx:5060;user=phone>
Call-ID: 168341746_132086108(a)213.xxx.xxx.xxx
CSeq: 373279 INVITE
Max-Forwards: 66
Allow: INVITE,ACK,CANCEL,BYE,REGISTER,REFER,INFO,SUBSCRIBE,NOTIFY,PRACK,UPDATE,OPTIONS,MESSAGE,PUBLISH
Accept: application/sdp, application/isup, application/dtmf, application/dtmf-relay, multipart/mixed
Contact: <sip:+43xxxxxxxx@213.xxx.xxx.xxx:5060>
P-Asserted-Identity: <sip:+43xxxxxxxx@alice.com:5060;user=phone>
Supported: timer,100rel,histinfo
P-Charging-Vector: icid-value=0d702d06-5700-103e-00-00-00-10-6b-03-dd-04;icid-generated-at=213.xxx.xxx.xxx
Session-Expires: 1800
Min-SE: 90
Content-Length: 252
Content-Disposition: session; handling=required
Content-Type: application/sdp
**_TH: dih
icid-value=0d702d06-5700-103e-00-00-00-10-6b-03-dd-04;icid-generated-at=213.xxx.xxx.xxx
Session-Exp_**
v=0
o=Sonus_UAC 278609 22801 IN IP4 92.xxx.xxx.xxx
s=SIP Media Capabilities
c=IN IP4 92.xxx.xxx.xxx
t=0 0
m=audio 34622 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=rtcp:34623
a=ptime:20
```
### Additional Information
```
version: kamailio 5.8.2 (x86_64/linux) 3fa5f4
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, MEM_JOIN_FREE, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_SEND_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: 3fa5f4
compiled on 15:54:29 Jul 22 2024 with gcc 10.2.1
```
* **Operating System**:
```
Debian GNU/Linux 11
5.10.0-26-amd64 #1 SMP Debian 5.10.197-1 (2023-09-29) x86_64 GNU/Linux
```
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3929
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3929(a)github.com>
#### Pre-Submission Checklist
- [x] Commit message has the format required by CONTRIBUTING guide
- [x] Commits are split per component (core, individual modules, libs, utils, ...)
- [ ] Each component has a single commit (if not, squash them into one commit)
- [x] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [x] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
- [x] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue #3592
#### Description
The `kamailio-geoip` RPM sub package currently builds both the `geoip` module - based on [the old and out of support MaxMind GeoIP library](https://github.com/maxmind/geoip-api-c) - and the newer `geoip2` module - based on [the currently supported `libmaxminddb`](https://github.com/maxmind/libmaxminddb).
The old GeoIP C library had its end of support date at May 2022 but for a while was still shipped for many distributions. At this point though, the EPEL repository that shipped the GeoIP library for RHEL-based operating systems, has removed it from their repositories for "Enterprise Linux 9":
![Screenshot_20240620_144233](https://github.com/kamailio/kamailio/assets/381782/bb1f2481-57f7-48af-b0f1-0ba1c14a3042)
Therefor builds using the bundled spec file fail on EL9 installations.
The suggested change is to add an RPM build option `--with geoip2` that when specified will build just the `geoip2` module for the `kamailio-geoip` RPM subpackage. This build option is not enabled by default, unless the build is running on a RHEL 9 based OS - in which case it is set as the default, because otherwise trivial builds break. To revert to the older behavior in RHEL 9 based OSs (and assuming you have the required unsupported library installed correctly) one will need to set both `--without geoip2 --with geoip`.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3886
-- Commit Summary --
* packaging: RPM build option to build just the geoip2 module
* packaging: make 'with geoip2' the default behavior for EL9
-- File Changes --
M pkg/kamailio/obs/kamailio.spec (36)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3886.patchhttps://github.com/kamailio/kamailio/pull/3886.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3886
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3886(a)github.com>
Hi! it seems the pua module in send_subscribe ( ) is leaking some memory because the hentity is not released.
According to memory allocations the shmem allocated for hentity is not cleaned.
```
1454582 file = 0x70e59fd30209 "usrloc: ../../core/ut.h", func = 0x70e59fd326c8 <__func__.16> "shm_str_dup", mname = 0x70e59fd2fdf0 "usrloc", line = 722
698090 file = 0x604218f2fcd5 "core: core/xavp.c", func = 0x604218f31988 <__func__.9> "xavp_new_value", mname = 0x604218f2fcd0 "core", line = 100
360187 file = 0x70e59fd30663 "usrloc: ucontact.c", func = 0x70e59fd326b8 <__func__.17> "new_ucontact", mname = 0x70e59fd2fdf0 "usrloc", line = 94
34208 file = 0x70e59fc91ae9 "pua: send_subscribe.c", func = 0x70e59fc94c80 <__func__.2> "subscribe_cbparam", mname = 0x70e59fc917e0 "pua", line = 773
5569 file = 0x70e59fc91ae9 "pua: send_subscribe.c", func = 0x70e59fc94ca0 <__func__.1> "subs_cbparam_indlg", mname = 0x70e59fc917e0 "pua", line = 861
64 file = 0x70e5a231f424 "tmx: tmx_pretran.c", func = 0x70e5a2320230 <__func__.0> "tmx_check_pretran", mname = 0x70e5a231f420 "tmx", line = 271
64 file = 0x70e5a231f424 "tmx: tmx_pretran.c", func = 0x70e5a2320230 <__func__.0> "tmx_check_pretran", mname = 0x70e5a231f420 "tmx", line = 250
7 file = 0x70e59fc86854 "pua: event_list.c", func = 0x70e59fc86ad0 <__func__.1> "add_pua_event", mname = 0x70e59fc86850 "pua", line = 72
3 file = 0x70e5a297c249 "license: ../../core/ut.h", func = 0x70e5a297d4f8 <__func__.3> "shm_str_dup", mname = 0x70e5a297c000 "license", line = 722
3 file = 0x70e59fd329d4 "usrloc: udomain.c", func = 0x70e59fd35660 <__func__.22> "build_stat_name", mname = 0x70e59fd328a0 "usrloc", line = 56
```
According to mod_stats for shmem over RPC the pua module was taking double as much memory as usrloc on the busy system.
I have tried to address the issue shown on lines 773 and 861 and added clearing of hentity at the end of send_subscribe () :
but it had caused the subscribe_200 outside of dialog to crash kamailio because of running the tm callback that accesses the hentity which is already free'd
So I thought perhaps another approach is required and the tm callback should clean it, while I must say i do not 100% clear understand why this needs to be so complicated compared to other modules. Perhaps i have missed another bug and overcomplicated things because the uac_r seems to be cleaned just fine.
The issue around the hentity does not seem to be solved in the latest releases while this is 5.3-something custom build.
Anyway my last resort that could help is convert to use tm to clear memory once it is done, in tm/uac.c : t_uac_prepare() is registering a callback with release function
```
if(uac_r->cb && insert_tmcb(&(new_cell->tmcb_hl), uac_r->cb_flags,
*(uac_r->cb), uac_r->cbp, NULL)!=1){
ret=E_OUT_OF_MEM;
LM_ERR("short of tmcb shmem\n");
goto error1;
}
int insert_tmcb(struct tmcb_head_list *cb_list, int types,
transaction_cb f, void *param,
release_tmcb_param rel_func)
{
```
is there any example of using such a relfunc in the other modules? Or anyone else has see the pua causing a mem leak when it is subscribed to reginfo from the config? I would appreciate some ideas what could be the issue and the solution.
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3928
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3928(a)github.com>
If the traction is set to auto drop,
the memory will be freed and with it the next pointer.
<!-- Kamailio Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [x] Commit message has the format required by CONTRIBUTING guide
- [x] Commits are split per component (core, individual modules, libs, utils, ...)
- [x] Each component has a single commit (if not, squash them into one commit)
- [x] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [x] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [ ] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
The use after free caused on a Load tested system crashes.
Now the next pointer is saved before executing the callback and handle the auto drop.
Then the stored next pointer is used to continue the iteration over the callbacks.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3931
-- Commit Summary --
* cdp: fix use after free in transaction call backs
-- File Changes --
M src/modules/cdp/transaction.c (3)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3931.patchhttps://github.com/kamailio/kamailio/pull/3931.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3931
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3931(a)github.com>
Module: kamailio
Branch: master
Commit: a71bd9d9424456ef1167468c5bbbfd38b1099e89
URL: https://github.com/kamailio/kamailio/commit/a71bd9d9424456ef1167468c5bbbfd3…
Author: Rick Barenthin <rick(a)ng-voice.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-07-25T12:20:59+02:00
cdp: fix use after free in transaction call backs
If the traction is set to auto drop,
the memory will be freed and with it the next pointer.
---
Modified: src/modules/cdp/transaction.c
---
Diff: https://github.com/kamailio/kamailio/commit/a71bd9d9424456ef1167468c5bbbfd3…
Patch: https://github.com/kamailio/kamailio/commit/a71bd9d9424456ef1167468c5bbbfd3…
---
diff --git a/src/modules/cdp/transaction.c b/src/modules/cdp/transaction.c
index f1445ff15be..a2b97654dd0 100644
--- a/src/modules/cdp/transaction.c
+++ b/src/modules/cdp/transaction.c
@@ -256,10 +256,11 @@ int cdp_trans_timer(time_t now, void *ptr)
/* do all queued callbacks */
x = cb_queue->head;
while(x) {
+ n = x->next;
(x->cb)(1, *(x->ptr), 0, (now - x->expires));
if(x->auto_drop)
cdp_free_trans(x);
- x = x->next;
+ x = n;
}
pkg_free(cb_queue);