giangi created an issue (kamailio/kamailio#4236)

### Description

The mode flag value 16 (int) in `ds_is_from_list()` is supposed to provide a 
"best matching" candidate, however it does not seem to recognize anything other 
than exact matches. 

### Troubleshooting

#### Reproduction

With the following `dispatcher.list`  

```
# setid(int) destination(sip uri) flags(int,opt) priority(int,opt) 
attributes(str,opt)

1 sip:127.1.2.3:5060
1 sip:127.1.2.3:5060;transport=tcp
```

The following invocations result in a match

```
ds_is_from_list("-1", "16", "sip:127.1.2.3:5060");
ds_is_from_list("-1", "16", "sip:127.1.2.3:5060;transport=tcp");
```

while others, e.g. some with some mismatching ports, but a valid address, fail 
to match

```
ds_is_from_list("-1", "16", "sip:127.1.2.3:12345");
ds_is_from_list("-1", "16", "sip:127.1.2.3:12345;transport=tcp");
```

### Possible Solutions

The code of `ds_is_addr_from_set()` from `src/modules/dispatcher/dispatch.c` 
has some suspicious `continue` while evaluating the "strictness score" of nodes 
and deciding upon the best match. If I am not mistaken they may cause the code 
that updates the `ds_strictest_node` to never get executed, thus not providing 
any match at all.

### Additional Information

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

```
version: kamailio 5.8.6 (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_SEND_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 12.2.0
```

* **Operating System**: Debian 12 "bookworm"

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

Message ID: <kamailio/kamailio/issues/4...@github.com>
_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to