From 75f68294fc458d0ad7a6d63a4343970d723f1810 Mon Sep 17 00:00:00 2001 From: "Michael L. Young" Date: Wed, 15 Aug 2012 20:40:25 +0000 Subject: [PATCH] Fix Segfault When Registering SIP Over WebSockets The helper function, get_address_family_filter, in chan_sip for dns resolution by address family was not recognizing the websockets transport and resulting in a null pointer being sent to functions in netsock2, in an attempt to determine if we are bound to ANY address ([::]) or not. This patch fixes this issue by handling the transport types SIP_TRANSPORT_WS and SIP_TRANSPORT_WSS which results in a sock address being set properly for use in determining the address family. (closes issue ASTERISK-20221) Reported by: Sven Beisiegel Tested by: Sven Beisiegel, James Mortensen Patches: asterisk-20221-ws-family-filter.diff uploaded by Michael L. Young (license 5026) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@371295 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 3668c253b1..b0fd1edf30 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -27596,11 +27596,9 @@ int get_address_family_filter(unsigned int transport) if ((transport == SIP_TRANSPORT_UDP) || !transport) { addr = &bindaddr; - } - else if (transport == SIP_TRANSPORT_TCP) { + } else if (transport == SIP_TRANSPORT_TCP || transport == SIP_TRANSPORT_WS) { addr = &sip_tcp_desc.local_address; - } - else if (transport == SIP_TRANSPORT_TLS) { + } else if (transport == SIP_TRANSPORT_TLS || transport == SIP_TRANSPORT_WSS) { addr = &sip_tls_desc.local_address; }