[asterisk-bugs] [JIRA] (ASTERISK-29932) res_pjsip_sdp_rtp.c::create_rtp() binds to UDP6 for UDP4 peer on BSD

Justin T. Gibbs (JIRA) noreply at issues.asterisk.org
Tue Feb 22 15:48:06 CST 2022


Justin T. Gibbs created ASTERISK-29932:
------------------------------------------

             Summary: res_pjsip_sdp_rtp.c::create_rtp() binds to UDP6 for UDP4 peer on BSD
                 Key: ASTERISK-29932
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-29932
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Channels/chan_pjsip
    Affects Versions: 18.9.0
         Environment: FreeBSD 13.0-STABLE + Asterisk 18.10 + pjsip 2.11
IPv6 kernel support enabled, but no IPv6 configured interfaces
            Reporter: Justin T. Gibbs
            Severity: Major


First reported here (https://community.asterisk.org/t/pjsip-create-rtp-udp6-vs-udp4/83315). Pandemic intervened. Now I'm hoping to get to an acceptable solution that can be upstreamed into Asterisk.

On most BSD derived systems (iOS/MacOS, Free/Net/OpenBSD, etc.), IPv4 traffic is not routed to IPv6 sockets even when bound to the IPv6 wildcard address. Information about this policy is documented here (https://www.freebsd.org/cgi/man.cgi?query=inet6&sektion=4). This differs from the behavior of the Linux kernel.

PJSIP support current assumes that a wildcard bind will work for both IPv4 and IPv6 peers. This is incompatible with BSD systems.

There are two options to solving this:
1) Bind to the IPv4 wildcard address unless the media endpoint has an ipv6 address.
2) Bind and poll sockets for the wildcard address for both IPv4 and IPv6.

The attached patch does 1 and works for me. From the discussion in the community forum, there was some concern that doing so would break ICE. It's not clear to me that this is the case. It seems strange that an end-point exporting an IPv4 address would be proxied via IPv6. However, if this is allowed, I'm happy to implement option 2.

If the decision is to go with option 2, I'm looking for some guidance on the best/idiomatic way to do this in Asterisk. I don't believe there are any other cases where a single virtual channel binds multiple sockets. Adding this into the existing pjsip code looks like it will require a pretty extensive change. This is why I'd like to understand the preferred approach before I dig into implementing this.



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



More information about the asterisk-bugs mailing list