OpenSIPS / opensips

OpenSIPS is a GPL implementation of a multi-functionality SIP Server that targets to deliver a high-level technical solution (performance, security and quality) to be used in professional SIP server platforms.
https://opensips.org
Other
1.26k stars 577 forks source link

[BUG] tracer module vs opensips 3.4.3 #3298

Closed microgiantya closed 7 months ago

microgiantya commented 7 months ago

OpenSIPS version you are running

opensips -V
version: opensips 3.4.3 (x86_64/linux)
flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, HP_MALLOC, DBG_MALLOC, FAST_LOCK-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535
poll method support: poll, epoll, sigio_rt, select.
git revision: 3a891b908
main.c compiled on  with gcc 11

Describe the bug

Some hep messages have wrong source ip For example:

02/06/2024 01:35:52.925 +03:00: 192.168.254.136:5060 -> 192.168.254.136:5060
BYE sip:73830000000@192.168.254.136;did=31.bce01cb2 SIP/2.0
Via:  SIP/2.0/UDP 192.168.254.130:5060;branch=z9hG4bK299b.03ac8e04.0
From:  <sip:79523877222@192.168.254.130>;tag=as6c81f194
To:  3830000000 <sip:73830000000@192.168.254.136>;tag=as60c8f5bd
Call-ID: 031835cc48dc56c647307f573564ebce@192.168.254.187:5060
X-CID:  <null>
CSeq:  102 BYE
User-Agent:  vm11.l
Reason:  Q.850;cause=16
Content-Length:  0

To Reproduce

  1. add apt repo like described at https://apt.opensips.org/packages.php?v=3.4
  2. install opensips
  3. setup hep and trace
    
    loadmodule "proto_hep.so"
    modparam("proto_hep", "hep_id", "[hep_dst] 192.168.254.182:9060; transport=udp; version=3")
    modparam("proto_hep", "hep_capture_id", 5001)

loadmodule "tracer.so" modparam("tracer", "trace_on", 1 ) modparam("tracer", "trace_id", "[tid] uri=hep:hep_dst")

4. call trace in request route

if (!has_totag() && is_method("INVITE")) { trace("tid", "D"); ... }

6.  Make call with answer

**Expected behavior**
Correct source ip address for all hep messages

**Relevant System Logs**

Feb 06 01:58:48 opensips opensips[8947]: Feb 6 01:58:48 [8947] DBG:tracer:sip_trace: sip_trace called Feb 06 01:58:48 opensips opensips[8947]: Feb 6 01:58:48 [8947] DBG:tracer:is_id_traced: trace=on dyn=off Feb 06 01:58:48 opensips opensips[8947]: Feb 6 01:58:48 [8947] DBG:tracer:pipport2su: proto 17, host 192.168.254.136 , port 5060 Feb 06 01:58:48 opensips opensips[8947]: Feb 6 01:58:48 [8947] DBG:tracer:pipport2su: proto 17, host 192.168.254.136 , port 5060


**OS/environment information**
 - Operating System: debian 12 or ubuntu 22
 - OpenSIPS installation: apt
 - other relevant information:
 have two interfaces:

2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 06:55:ae:c9:e8:c1 brd ff:ff:ff:ff:ff:ff altname enp0s18 inet 192.168.254.136/24 metric 100 brd 192.168.254.255 scope global dynamic ens18 valid_lft 482sec preferred_lft 482sec inet6 fe80::455:aeff:fec9:e8c1/64 scope link valid_lft forever preferred_lft forever 3: ens19: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 36:ed:46:1a:14:61 brd ff:ff:ff:ff:ff:ff altname enp0s19 inet 192.168.253.1/24 brd 192.168.253.255 scope global ens19 valid_lft forever preferred_lft forever inet6 fe80::34ed:46ff:fe1a:1461/64 scope link valid_lft forever preferred_lft forever

default via 192.168.254.254 dev ens18 proto dhcp src 192.168.254.136 metric 100 192.168.253.0/24 dev ens19 proto kernel scope link src 192.168.253.1 192.168.254.0/24 dev ens18 proto kernel scope link src 192.168.254.136 metric 100 192.168.254.254 dev ens18 proto dhcp scope link src 192.168.254.136 metric 100



**Additional context**
Tested with opensips 3.2 from official apt repository - all messages are correct.
But with opensips 3.4 it looks like:
(homer ui):
![image](https://github.com/OpenSIPS/opensips/assets/81983258/90e53012-932e-407b-b219-9cde46ba59da)
(wireshark):
![image](https://github.com/OpenSIPS/opensips/assets/81983258/86f1033b-b9ae-42a7-ba27-25a0ef41b2a8)
microgiantya commented 7 months ago

Hi @liviuchircu! Does commit 072abebe984f0ed94f300714792b119e41fc145b fix this bug?

Author: Liviu Chircu <liviu@opensips.org>
Date:   Thu Jan 11 14:44:46 2024 +0200

    tracer: Fix mixing between "src_ip" and "dst_ip"

    Completes a13e03420c

    Credits to James Seer for reporting this issue!

    (cherry picked from commit fd894705feacc95f1eae1af2d6554ce2b10bf5ad)

If it does, hi @razvancrainea, when we can get updates on apt repo?

P.S.: I got latest (7edd32586) sources from 3.4 branch, make all && install, and callflow looks perfect.

bogdan-iancu commented 7 months ago

yes, 072abebe984f0ed94f300714792b119e41fc145b is the fix and it was backported and available on all packages (check for the nightly builds)

microgiantya commented 7 months ago

Thank you, appreciate it.