On 13/01/15 00:28, Mikko Lehto wrote:
Juha Heinanen jh@tutpro.com:
in case of tcp (and tls) the source port is always a random one. only the destination port can be predetermined.
OK, thanks. I'll go with that then.
Actually I can see non-random port with TLS... ...but that's with Homer + sip_trace() captured traffic. I'll write another thread about that.
I checked the code and there is a bind() to local socket before doing tcp connect(). That should preserve the source port of the local address (socket) Kamailio is listening on. However, it is not guaranteed that the OS can do that, if there is an overlap on (source ip, source port, destination ip, destination port) with another connection. From the code, a warning message should be printed in logs. It also depends on OS and kernel versions.
Apparently next link is a good article about (didn't have time to read it all):
- https://idea.popcount.org/2014-04-03-bind-before-connect/
Cheers, Daniel