error creating IPv6 profile when corresponding IPv4 port in use
Here's the scenario (FreeSWITCH revision 10725). I have Asterisk listening on port 5060 under IPv4. This version of Asterisk does not support IPv6, and netstat -6 -a | grep sip suggests that, as expected, it isn't listening on port 5060 under IPv6. If I set up FreeSWITCH profiles to listen on port 5070, for example, under both IPv4 and IPv6 then it works fine. However, if I create an IPv4 profile to listen on port 5070, and an IPv6 profile to listen on port 5060, Sofia fails with a "port already in use" error, even though nothing should be using port 5060 under IPv6.
From the logs:
tport_create(): 0x1b4d0e0 tport_bind_server(0x1b4d0e0) to */[2001:44b8:61::3b]:5060/sip tport_bind_server(0x1b4d0e0): calling tport_listen for udp tport_alloc_primary(0x1b4d0e0): new primary tport 0x1b4f010 tport_listen(0x1b4d0e0): bind(pf=10 udp/[2001:44b8:61::3b]:5060): Address already in use tport_destroy(0x1b4d0e0) nta: bind([2001:44b8:61::3b]:5060;transport=*): Address already in use nua: initializing SIP stack failed Obviously, I can easily use a different port, and hence this issue doesn't affect me. However, if it's a bug, I think it should still go into the bug list. I realize the problem might not be in Sofia or FreeSWITCH. Is Asterisk really taking over the IPv6 port as well? Environment: Debian Sid, kernel 2.6.26, x86_64 architecture. Note: once I learn enough about FreeSWITCH to configure it properly and set it up to meet my personal telephony needs, the Asterisk installation will be, shall we say, redundant.
Well the OS reports its in use when we try to bind not much we can do about that ... what does netstat -na | grep 5060 show? /b On Dec 16, 2008, at 11:07 PM, Jason White wrote:
nta: bind([2001:44b8:61::3b]:5060;transport=*): Address already in use
On Tue, Dec 16, 2008 at 11:10:19PM -0600, Brian West wrote:
Well the OS reports its in use when we try to bind not much we can do about that ... what does netstat -na | grep 5060 show?
udp 0 0 0.0.0.0:5060 0.0.0.0:* I'll take it, then, that this is a non-issue?
The code in bind6only_check in libs/sofia-sip/libsofia-sip-ua/tport/tport.c looks correct to me, but I can't find where the result is tested (it's in mr_bindv6only). When bind6only_check() is called in tport_bind_server(), the return value isn't tested, and I'm having difficulty finding where it is used - I'm interested in whether we're in fact attempting to bind only to the IPv6 port and whether the logic is correct here. When I find the time, I could rebuild with debug symbols and run it under gdb.
On Dec 17, 2008, at 2:40 AM, Jason White wrote:
The code in bind6only_check in libs/sofia-sip/libsofia-sip-ua/tport/ tport.c looks correct to me, but I can't find where the result is tested (it's in mr_bindv6only). When bind6only_check() is called in tport_bind_server(), the return value isn't tested, and I'm having difficulty finding where it is used - I'm interested in whether we're in fact attempting to bind only to the IPv6 port and whether the logic is correct here.
When I find the time, I could rebuild with debug symbols and run it under gdb.
If this is in fact a bug, could you please report it to the sofia-sip bugtracker. Patches are very helpful there. Mike
On Wed, Dec 17, 2008 at 12:10:18PM -0500, Michael Jerris wrote:
On Dec 17, 2008, at 2:40 AM, Jason White wrote:
The code in bind6only_check in libs/sofia-sip/libsofia-sip-ua/tport/ tport.c looks correct to me, but I can't find where the result is tested (it's in mr_bindv6only). When bind6only_check() is called in tport_bind_server(), the return value isn't tested, and I'm having difficulty finding where it is used
I realized after posting that if the IPv4 port is bound by another process, then the attempt to bind to the IPv4 port in bind6only_check() should return -1, and hence the result of bind6only_check() will be 0, even if the os allows the IPv6 and IPv4 ports to be bound independently of each other. This looks like a potential bug, but I haven't investigated properly to be sure, and I'm extremely busy just now (as well as not being very experienced at this).
If this is in fact a bug, could you please report it to the sofia-sip bugtracker. Patches are very helpful there.
If anyone else has a chance to look at it before I do, please let me know. Otherwise, I'll check it out when I have time to build a version of FreeSWITCH with debug symbols and run it under gdb.
I bind mine independently without a problem on CentOS 5.2 /b On Dec 18, 2008, at 2:53 AM, Jason White wrote:
I realized after posting that if the IPv4 port is bound by another process, then the attempt to bind to the IPv4 port in bind6only_check() should return -1, and hence the result of bind6only_check() will be 0, even if the os allows the IPv6 and IPv4 ports to be bound independently of each other.
On Thu, Dec 18, 2008 at 03:01:12AM -0600, Brian West wrote:
I bind mine independently without a problem on CentOS 5.2
Thanks; friends of mine have access to Fedora boxes, so we'll compare behaviour and try to sort it out.
The solution was to edit /etc/asterisk/sip.conf and change bindaddr = 0.0.0.0 to bindaddr = x.x.x.x where x.x.x.x is, naturally, replaced by the host's actual IPv4 address. Following this change to the Asterisk configuration, Asterisk can bind to port 5060 under IPv4, and FreeSWITCH can bind to port 5060 under IPv6.
participants (3)
-
Brian West
-
Jason White
-
Michael Jerris