<p></p>

<h3>Description</h3>
<ol>
<li>Using function <code>sip_trace_mode()</code> with parameter <code>d</code> to enable dialog tracing mode logs:</li>
</ol>
<pre><code>BUG: siptrace [siptrace.c:1671]: add_info_xavp(): URI should be in raw format here
ERROR: siptrace [siptrace.c:888]: sip_trace_helper(): failed to serialize siptrace info! Won't trace dialog!
</code></pre>
<ol start="2">
<li>If <code>trace_flag</code> is set and <code>sip_trace_mode("d")</code> is used before one of the parameterized variants of <code>sip_trace()</code> Kamailio segfaults.</li>
</ol>
<h3>Troubleshooting</h3>
<h4>Reproduction</h4>
<p>module parameters:</p>
<pre><code>#!define FLT_SIPTRACE 5
modparam("siptrace", "trace_mode", 0)
modparam("siptrace", "trace_flag", FLT_SIPTRACE)
modparam("siptrace", "trace_on", 1)
modparam("siptrace", "trace_to_database", 0)
modparam("siptrace", "hep_mode_on", 1)
modparam("siptrace", "hep_version", 3)
modparam("siptrace", "hep_capture_id", 1234)
</code></pre>
<ol>
<li></li>
</ol>
<pre><code>request_route {
...
  if (is_method("INVITE")) {
    sip_trace_mode("d");
  }
}
</code></pre>
<ol start="2">
<li></li>
</ol>
<pre><code>request_route {
...
  if (is_method("INVITE")) {
    setflag(FLT_SIPTRACE);
    sip_trace_mode("d");
    sip_trace("sip:1.2.3.4:9060");
  }
}
</code></pre>
<h4>Debugging Data</h4>

<pre><code>(gdb) bt
#0  0x00007f498ffddeaf in memcpy () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007f495ffb5369 in sip_trace_helper (msg=0x7f498c1703b8, dst=0x7fff45477ab0, duri=0x7fff45477a50, corid=0x0, dir=0x0, trace_type=SIPTRACE_TRANSACTION) at siptrace.c:871
#2  0x00007f495ffb7729 in w_sip_trace3 (msg=0x7f498c1703b8, dest=0x7f498c0863a8 "\210S\t\214I\177", correlation_id=0x0, trace_type_p=0x0) at siptrace.c:1041
#3  0x00007f495ffb6774 in w_sip_trace1 (msg=0x7f498c1703b8, dest=0x7f498c0863a8 "\210S\t\214I\177", p2=0x0) at siptrace.c:978
#4  0x00005603f0600ea1 in do_action (h=0x7fff45479270, a=0x7f498c0949a0, msg=0x7f498c1703b8) at core/action.c:1079
#5  0x00005603f060f4bd in run_actions (h=0x7fff45479270, a=0x7f498c093ca8, msg=0x7f498c1703b8) at core/action.c:1578
#6  0x00005603f0600d85 in do_action (h=0x7fff45479270, a=0x7f498c0a3758, msg=0x7f498c1703b8) at core/action.c:1064
#7  0x00005603f060f4bd in run_actions (h=0x7fff45479270, a=0x7f498c08f758, msg=0x7f498c1703b8) at core/action.c:1578
#8  0x00005603f060b397 in do_action (h=0x7fff45479270, a=0x7f498c0a3f68, msg=0x7f498c1703b8) at core/action.c:1248
#9  0x00005603f060f4bd in run_actions (h=0x7fff45479270, a=0x7f498c019500, msg=0x7f498c1703b8) at core/action.c:1578
#10 0x00005603f060fd0b in run_top_route (a=0x7f498c019500, msg=0x7f498c1703b8, c=0x0) at core/action.c:1663
...
(gdb) frame 1
#1  0x00007f495ffb5369 in sip_trace_helper (msg=0x7f498c1703b8, dst=0x7fff45477ab0, duri=0x7fff45477a50, corid=0x0, dir=0x0, trace_type=SIPTRACE_TRANSACTION) at siptrace.c:871
871                             memcpy(info->u.dup_uri.s, duri->s, duri->len);
(gdb) info locals
alloc_size = 88
info = 0x7f4967941fe0
__func__ = "sip_trace_helper"
(gdb) p *info
$1 = {correlation_id = {s = 0x0, len = 0}, u = {dup_uri = {s = 0x0, len = 0}, dest_info = {send_sock = 0x0, to = {s = {sa_family = 0, sa_data = '\000' <repeats 13 times>}, sin = {sin_family = 0, sin_port = 0, sin_addr = {s_addr = 0},
          sin_zero = "\000\000\000\000\000\000\000"}, sin6 = {sin6_family = 0, sin6_port = 0, sin6_flowinfo = 0, sin6_addr = {__in6_u = {__u6_addr8 = '\000' <repeats 15 times>, __u6_addr16 = {0, 0, 0, 0, 0, 0, 0, 0}, __u6_addr32 = {0, 0, 0, 0}}}, sin6_scope_id = 0}},
      id = 0, send_flags = {f = 0, blst_imask = 0}, proto = 0 '\000', proto_pad0 = 0 '\000', proto_pad1 = 0}}, uriState = STRACE_RAW_URI}
(gdb) p *dst
$2 = {send_sock = 0x0, to = {s = {sa_family = 2, sa_data = "#d\001\002\003\004\000\000\000\000\000\000\000"}, sin = {sin_family = 2, sin_port = 25635, sin_addr = {s_addr = 67305985}, sin_zero = "\000\000\000\000\000\000\000"}, sin6 = {sin6_family = 2,
      sin6_port = 25635, sin6_flowinfo = 67305985, sin6_addr = {__in6_u = {__u6_addr8 = '\000' <repeats 15 times>, __u6_addr16 = {0, 0, 0, 0, 0, 0, 0, 0}, __u6_addr32 = {0, 0, 0, 0}}}, sin6_scope_id = 0}}, id = 0, send_flags = {f = 0, blst_imask = 0}, proto = 1 '\001',
  proto_pad0 = 0 '\000', proto_pad1 = 0}
</code></pre>
<h3>Additional Information</h3>
<ul>
<li><strong>Kamailio Version</strong> - output of <code>kamailio -v</code></li>
</ul>
<pre><code>% kamailio -v
version: kamailio 5.4.0-dev3 (x86_64/linux)
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, 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_BLACKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_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: unknown
compiled with gcc 6.3.0
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/2250">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZMQB2CK2SKFO356IIDRHEN3NANCNFSM4LGR5I7A">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZPYHY57M7IK5K2OKHLRHEN3NA5CNFSM4LGR5I7KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IUTZS5Q.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/2250",
"url": "https://github.com/kamailio/kamailio/issues/2250",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>