[asterisk-dev] NAT mapping while binding to IPv6

Jeremy Visser jeremy at visser.name
Sun Sep 4 10:07:53 CDT 2011


Hi folks,

I'm having an issue with NAT mapping and IPv6. Basically the scenario is that if tcp/udpbindaddr=[::], then the nat=yes option I specified in sip.conf is ignored. This is a problem because the fact that some of my SIP clients supporting IPv6 doesn't magically mean the IPv4-only ones aren't behind NATs any more.

So I'm forced to support v4-only in order to not break NAT'ed clients.

In ast_sip_ouraddrfor() in chan_sip.c, there is some "if (ast_sockaddr_is_ipv6(&theirs))" logic which seems to divert along a separate code path for when binding to an IPv6 socket that doesn't support NAT mapping.

I'm not a qualified C coder so please forgive me if I am completely wrong here, but am I right in guessing that the NAT handling code is hardcoded to expect AF_INET structures, whereas the code path taken if ast_sockaddr_is_ipv6() is true uses AF_INET6, leading to the fact that the nat= option is being ignored?

I'm not cluey enough to know how this works, but what would it take to get nat=yes support while binding to an IPv6 address?

I mentioned this on IRC a couple of months ago and was advised to post to this list.

Cheers,
Jeremy.


More information about the asterisk-dev mailing list