[asterisk-bugs] [JIRA] (ASTERISK-29402) res_pjsip_t38: Socket is bound to IPv4/IPv6 but platform does not support it

Matthew Kern (JIRA) noreply at issues.asterisk.org
Wed Jul 14 09:12:33 CDT 2021


    [ https://issues.asterisk.org/jira/browse/ASTERISK-29402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=255619#comment-255619 ] 

Matthew Kern commented on ASTERISK-29402:
-----------------------------------------

I've worked on this a little, and I came up with a patch which essentially copies the initialization code from res_pjsip_sdp_rtp.c into res_pjsip_t38.c. Basically, instead of always binding to the address determined in load_module(), this adds a "t38_bind_udptl_to_media_address" option for pjsip endpoints, and falls back to using the transport's bind address (before falling back to the current behavior) - almost word-for-word out of res_pjsip_sdp_rtp.c.

When I test on my setup, the bind to media address works for the internal endpoint (the fax ATA), but it uses the transport address for the trunk side. This is identical to the behavior I see in the RTP side for voice calls, as you might expect. This fixes my problem, since both endpoints end up binding to the intended ipv4 address.

Please bear with me while I try to work through the patch submission process - it's been many years since I've done a patch for an OSS project.

> res_pjsip_t38: Socket is bound to IPv4/IPv6 but platform does not support it
> ----------------------------------------------------------------------------
>
>                 Key: ASTERISK-29402
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-29402
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_pjsip_t38
>    Affects Versions: 18.3.0
>         Environment: Running as a Linux binary on FreeBSD's Linux emulation layer.
>            Reporter: Matthew Kern
>
> On environments such as this, sockets bound to ipv6 addresses cannot be used to pass ipv4 traffic (I am unsure of the exact deeper issue here, but it seems to do with the bind() address, not the call to socket()). ast_check_ipv6() (from main/utils.c) only detects whether an AF_INET6 socket can be opened at all (which it can in this env, so ast_check_ipv6() returns 1 by default).
> According to a quick search, ast_check_ipv6() is only called in two spots - the load_module() for res_pjsip_t38.c and res_pjsip_sdp_rtp.c
> The sdp/rtp module works fine this way, but only with the bind_rtp_to_media_address option set (i.e. since I'm forcing the socket to bind() to an ipv4 address, ipv4 packets can pass. Without this option I get similar EINVAL sends).
> Unfortunately, there is no equivalent option for the T38 module. Working around this, either so that ast_check_ipv6() always returns 0, or disabling the check in load_module and forcing address to "0.0.0.0", yields a fully working system.
> Please either implement a configuration option to force ast_check_ipv6() to return 0, or implement a configuration option to set the bind() address for the T38 module (e.g. bind_t38_to_media_address would be a legitimate solution here), for the sake of other systems with this particular problem.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list