<!--
Kamailio Project uses GitHub Issues only for bugs in the code or feature requests.
If you have questions about using Kamailio or related to its configuration file,
ask on sr-users mailing list:
*
http://lists.sip-router.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.sip-router.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 you submit a feature request (or enhancement), you can delete the text of
the template and only add the description of what you would like to be added.
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
<!--
Explain what you did, what you expected to happen, and what actually happened.
-->
### Troubleshooting
#### Reproduction
we have an issue with our Kamailio.
This configuration is multi-homed, we have two network interfaces, one on a private
network and on the public Internet. Kamailio is configured to listen on port 5060 and 5066
on both interfaces. We register two users Alice and Bob on the public Internet using port
5066. Both users are behind a NAT and we capture the SIP exchange on the proxy server.
We have set the parameter mhomed=1
![image](https://user-images.githubusercontent.com/16304253/35796442-e642d466-0a5c-11e8-846f-a538e3185a69.png)
The ACK packet gets relayed with the wrong source port. Then the NAT rejects the packet
and the call cannot be established.
Also, if we set mhomed=0 it works BUT we are not sure that multi homed is handled
correctly.
the issue seems to be located in the RR module and the loose_route() function.
In the after_loose() function in loose.c, the function set_force_socket() is called
only if a DOUBLE route is mentioned in the route set of the ACK message
But when both users are using 5066 as proxy port, we get only ONE route for the proxy in
the route set (and to us it is OK). In this case, we get a trace:
"No next URI found"
and the code exits. Later in the message processing, when t_relay() is called, the
forward_request() selects the first socket defined in our configuration instead.
At this point, we can't presume what socket we be select. We believe that it is a
software bug and that after_loose() should force the send_socket even though we have only
one route in the route set
#### 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
Adding the process of set_force_socket in case we have one route and only.
L.808 if (res > 0) { /* No next route found */
LM_DBG("No next URI found\n");
if (!use_ob) {
if ((si = grep_sock_info( &puri.host,
puri.port_no?puri.port_no:proto_default_port(puri.proto), puri.proto)) != 0) {
set_force_socket(_m, si);
} else if ((si = grep_sock_info( &puri.host, puri.port_no, puri.proto)) != 0) {
set_force_socket(_m, si);
} else {
if (enable_socket_mismatch_warning) {
LM_WARN("no socket found to match second RR (%.*s)\n",
rt->nameaddr.uri.len, ZSW(rt->nameaddr.uri.s));
if(!is_myself(&puri)) {
LM_WARN("second RR uri is not myself (%.*s)\n",
rt->nameaddr.uri.len, ZSW(rt->nameaddr.uri.s));
}
}
}
}
status = (preloaded ? NOT_RR_DRIVEN : RR_DRIVEN);
goto done;
}
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
(paste your output here)
```
* **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/1428