Comments (11)
I've worked with @sipgate-uhlig on this topic. He's out of office this week so I took a look at it together with another colleague. We can confirm that the latest master branch does no longer suffer from this issue . Thank you @miconda for resolving this so quickly!
Can we assume that it will be part of Kamailio 5.8.2 and if so, is there an ETA?
from kamailio.
another way to do it (just as a workaround)
``
modparam("sipdump", "event_callback", "sipdump_event")
//you can check everything here - method, si, RI and send to a destination.
event_route[sipdump_event] {
sip_trace("sip:10.1.1.2:5085", "$ci-abc");
}
``
from kamailio.
btw, same you can do for sipcapture:request - execute manual sip_trace and after send return 0 or exit;
from kamailio.
@adubovikov: as I see it right now, by replicating at SIP level (e.g., via sip dump) to another system, the original source ip/destination IP are lost in the receiving system. They can eventually be added as custom headers.
from kamailio.
@adubovikov: as I see it right now, by replicating at SIP level (e.g., via sip dump) to another system, the original source ip/destination IP are lost in the receiving system. They can eventually be added as custom headers.
or we should set the hep variables. Anyway @sipgate-uhlig is talking about the corrupted $Ri and $si and unfortunately this is not related to the siptrace module. Do you have any idea ?
from kamailio.
Thank you for your input so far. All the alternatives seem to work-around the issue but not fulfill our needs.
We have debugged a little using gdb
. We noticed that the value of msg->rcv->bind_address->address_str
is correct before calling do_action
. Afterwards, it is wrong.
Before:
s = "172.20.21.3"
len = 11
After:
s = "217.116.120.247"
len = 11 (sic!)
We took a closer look (step by step) and the problem seems to be using ip_addr2a
. It returns a pointer to a local static char[]
. This is assigned to the original struct of address_str
inside of parsing_hepv3_message
.
Later, when ip_addr2a
is called again for xlog, then the same address is used again and hence the value of address_str.s
is overwriten.
A quick look at the git history for the functions did not show any relevant changes to my untrained eyes.
As the jump from 5.1/5.4 (debian jessie) to 5.5/5.8 (debian bookworm) is kind of huge, maybe this is related to changes in the compiler?
from kamailio.
Thank you for your input so far. All the alternatives seem to work-around the issue but not fulfill our needs.
We have debugged a little using
gdb
. We noticed that the value ofmsg->rcv->bind_address->address_str
is correct before callingdo_action
. Afterwards, it is wrong.Before:
s = "172.20.21.3" len = 11
After:
s = "217.116.120.247" len = 11 (sic!)
We took a closer look (step by step) and the problem seems to be using
ip_addr2a
. It returns a pointer to a local staticchar[]
. This is assigned to the original struct ofaddress_str
inside ofparsing_hepv3_message
.Later, when
ip_addr2a
is called again for xlog, then the same address is used again and hence the value ofaddress_str.s
is overwriten.A quick look at the git history for the functions did not show any relevant changes to my untrained eyes.
As the jump from 5.1/5.4 (debian jessie) to 5.5/5.8 (debian bookworm) is kind of huge, maybe this is related to changes in the compiler?
ok, it can be related to the struct pack, need to check it the union works correct. What is the compiler ?
https://github.com/kamailio/kamailio/blob/master/src/core/ip_addr.h#L74-L80
from kamailio.
For kamailio 5.8 we have used
# gcc --version
gcc (Debian 12.2.0-14) 12.2.0
from kamailio.
I am not a C developer so I have to guess here.
For me it looks like the static
address of buff
is returned by ip_addr2a
.
char *ip_addr2a(struct ip_addr *ip)
{
static char buff[IP_ADDR_MAX_STR_SIZE];
// ...
return buff;
}
If that's the case, I think every user of that function should copy the value from that address instead of remembering the address. Otherwise it is always the same address for every call of ip_addr2a
and subsequent calls overwrite the value of the previous call.
Unfortunately, the sipcapture module uses the returned value directly:
si->address_str.s = ip_addr2a(&si->address);
I tested with the following code and I think it confirms my theory because foo
changes to "bar".
#include <stdio.h>
#include <string.h>
char *a(char* in);
int main() {
char *foo = a("foo");
printf("foo %08x -> %08x = %s\n", &foo, foo, foo);
char *bar = a("bar");
printf("foo %08x -> %08x = %s\n", &foo, foo, foo);
printf("bar %08x -> %08x = %s\n", &bar, bar, bar);
}
char *a(char* in) {
static char out[10];
strcpy(out, in);
return out;
}
Output:
foo 0c3399d8 -> b37ba018 = foo
foo 0c3399d8 -> b37ba018 = bar
bar 0c3399e0 -> b37ba018 = bar
However, I can't explain why this should be any different in previous kamailio versions.
from kamailio.
Can you try with master branch or the patch from the commit references above?
from kamailio.
Related Issues (20)
- Mem leak in smsops which leads to the udp receiver process leak memory continuously HOT 5
- pua_dialoginfo fails to publish the caller when not using avps HOT 3
- phonenum: fails to build on sid HOT 1
- kamailio re-INVITE HOT 1
- Possible Mem leak in Core HOT 2
- Kamailio incoming call error HOT 1
- sql_query fails from tcp:closed event_route HOT 10
- Usrloc keepalive: Not sending OPTIONS to UDP endpoints- 5.8.0 and 5.8.1 HOT 3
- ims_registrar_pcscf: support for handling contact * value HOT 4
- Warnings emitted when calling functions from dialplan module HOT 5
- bad BYE message from endpoint when using topoh in kamailio 5.5.1 HOT 2
- rtpengine: multipart content dropped when used read_sdp_pv HOT 1
- ims_registrar_scscf: cannot build on Fedora 40 HOT 1
- Possible memory leak in siputils module HOT 1
- Kamailio core dump v5.6 with cncxx module HOT 9
- Problem loadmodule secsipid on kamailio 5.6.5 HOT 2
- Crash on shutdown after geoip2.reload HOT 3
- dispatcher not proxy sip on websocket HOT 1
- ims/pcscf: 200OK for de-registration (REGISTER with Expire:0) is not reaching to UE
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kamailio.