### Description

We've got a Kamailio setup on Ubuntu 20.04 with multiple TLS sockets: 5061 for 
SIPS, 8088 for WSS. When checking the received socket or port in the 
`onreply_route` for a packet received on the SIPS port, `$Rn`, `$Rn`, and 
`$Rut` contain information taken from the socket defined first in the 
configuration file. Swapping the `listen` statements in the attached minimal 
configuration leads to the respective other set of information being contained 
in the variables. The issue is reproducable with at least 5.7.0 and 5.7.1.

#### Reproduction

I've attached a (very) stripped down version of our configuration. The outline 
is as follows:

* Two TLS listen ports: 5061, 8088
* No websockets module – our actual configuration uses it, but it's not 
necessary to reproduce the issue
* A `request_route` relaying everything to another hardcoded SIP server – I've 
attached a SIPp scenario for the UAS role
* A `reply_route` printing `$Rp`, `$Rn`, and `$Rut` – at this point the issue 
has already occured, no further processing is necessary

With the listen directive for the `wss` socket above the directive for the 
`tls` socket, all inbound packets on port 5061 are logged as being received on 
the `wss` socket.

In the setup to reproduce the issue, 192.168.100.2 is the kamailio server and 
192.168.100.123 is the machine running the UAS on port 5061 and the UAC 
starting the call.

To reproduce, start Kamailio with the provided configuration file 
[minimal.cfg](https://github.com/kamailio/kamailio/files/12465577/minimal.txt). 
I've used the following command line:

```
/usr/sbin/kamailio -P /tmp/kamailio.pid -f minimal.cfg -E -e -m 512 -M 128 
--atexit=no -DD
```

Then, run the SIPp UAS scenario 
[uas_tls.xml](https://github.com/kamailio/kamailio/files/12465587/uas_tls.txt) 
with 

```
sipp -sf ~/ucware/sipp/scenarios/uas_tls.xml -trace_msg -trace_err -trace_logs 
-t l1 -i 192.168.100.123  -p 5061 -m 1 
```

Lastly, start a call using the SIPp scenario 
[wrong_port_call.xml](https://github.com/kamailio/kamailio/files/12465607/wrong_port_call.txt)
 with

```
sipp -sf wrong_port_call.xml -m 1 -trace_msg -trace_err 192.168.100.2:5060
```

### Additional Information

* **Kamailio version**:

```
version: kamailio 5.7.1 (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, 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_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 9.4.0
```

* **Operating System**:

```
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.6 LTS
Release:        20.04
Codename:       focal

$ uname -a
Linux kamailiotest 5.4.0-159-generic #176-Ubuntu SMP Mon Aug 14 12:04:20 UTC 
2023 x86_64 x86_64 x86_64 GNU/Linux

```


-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3553
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/issues/[email protected]>
_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to [email protected]

Reply via email to