[asterisk-dev] NAT mapping while binding to IPv6

Klaus Darilion klaus.mailinglists at pernau.at
Mon Sep 5 15:41:26 CDT 2011


On 04.09.2011 17:07, Jeremy Visser wrote:
> 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?

If v4 and v6 are really handled different, then it should be fixed. IMO 
nat=yes means nat=yes, regardless if transport is v4 or v6.

regards
Klaus



More information about the asterisk-dev mailing list