[sr-dev] [kamailio/kamailio] Siptrace patch review (#1955)

Daniel-Constantin Mierla notifications at github.com
Wed May 15 13:21:12 CEST 2019


<!--
Kamailio Project uses GitHub Issues only for bugs in the code or feature requests. Please use this template only for bug reports.

If you have questions about using Kamailio or related to its configuration file, ask on sr-users mailing list:

  * http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

If you have questions about developing extensions to Kamailio or its existing C code, ask on sr-dev mailing list:

  * http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Please try to fill this template as much as possible for any issue. It helps the developers to troubleshoot the issue.

If there is no content to be filled in a section, the entire section can be removed.

You can delete the comments from the template sections when filling.

You can delete next line and everything above before submitting (it is a comment).
-->

### Description

A patch was pushed to master branch to enable use of trace_type in the ki_sip_trace_dst_cid_flag(), following the latest additions to the module. It seemed that the trace type was used only for kamailio.cfg functions, because inside ki_sip_trace_dst_cid_flag() the trace_type was parsed and stored in local variable, but it was not used further.

I open this issue for review, to be sure something was not overlooked, the commit is:

  * e8d765610c6926cc6cb4dfa490595214a3680f97

@ionutionita92 - can you have a look and eventually do some tests to be sure it still works as expected for kamailio.cfg functions?

There is one more aspect to clarify. The trace info structure is alocated in shared memory, but some of its fields (duplicate uri and correlation id) were set to addresses of function parameters/local variables. The code was relocated and now is at the following lines:

  * https://github.com/kamailio/kamailio/blob/master/src/modules/siptrace/siptrace.c#L867-L875

Is it safe to do it like this? Are the fields used in this case only in current process and the callbacks use the variant stored in AVP?

Speaking of serializing to a string stored in AVP, it might be better to just have a structure compacted with all content in shared memory and stored in an XAVP -- the xavp can store a pointer and also have in its structure the callback to free the pointer.

<!--
Explain what you did, what you expected to happen, and what actually happened.
-->

### Troubleshooting

#### Reproduction

<!--
If the issue can be reproduced, describe how it can be done.
-->

#### Debugging Data

<!--
If you got a core dump, use gdb to extract troubleshooting data - full backtrace,
local variables and the list of the code at the issue location.

  gdb /path/to/kamailio /path/to/corefile
  bt full
  info locals
  list

If you are familiar with gdb, feel free to attach more of what you consider to
be relevant.
-->

```
(paste your debugging data here)
```

#### 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

<!--
If the issue is exposed by processing specific SIP messages, grab them with ngrep or save in a pcap file, then add them next, or attach to issue, or provide a link to download them (e.g., to a pastebin site).
-->

```
(paste your sip traffic here)
```

### Possible Solutions

<!--
If you found a solution or workaround for the issue, describe it. Ideally, provide a pull request with a fix.
-->

### Additional Information

  * **Kamailio Version** - output of `kamailio -v`

```
Git Master Branch
```

* **Operating System**:

<!--
Details about the operating system, the type: Linux (e.g.,: Debian 8.4, Ubuntu 16.04, CentOS 7.1, ...), MacOS, xBSD, Solaris, ...;
Kernel details (output of `uname -a`)
-->

```
(paste your output here)
```


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1955
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20190515/a21261c2/attachment-0001.html>


More information about the sr-dev mailing list