fix issues with unitialized address family; one when outboundproxy
is used, reported by Alexey Suslikov, one with dnsmgr when the looked-up IP address of a peer changes (bug 15827).
This commit is contained in:
parent
f863d50f38
commit
82aee579ee
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.78 2010/04/08 16:18:00 sthen Exp $
|
||||
# $OpenBSD: Makefile,v 1.79 2010/04/09 11:05:55 sthen Exp $
|
||||
|
||||
SHARED_ONLY= Yes
|
||||
COMMENT-main= open source multi-protocol PBX and telephony toolkit
|
||||
@ -6,7 +6,7 @@ COMMENT-main= open source multi-protocol PBX and telephony toolkit
|
||||
VER= 1.6.2.6
|
||||
# you can set PATCHVER=p0, p1 etc to bump everything,
|
||||
# this takes care of the subpackage/flavor maze
|
||||
#PATCHVER= p0
|
||||
PATCHVER= p0
|
||||
CORESOUNDS= 1.4.17
|
||||
DISTNAME= asterisk-${VER:S/rc/-rc/}
|
||||
PKGNAME-main= asterisk-${VER}${PATCHVER}
|
||||
|
14
telephony/asterisk/patches/patch-channels_chan_sip_c
Normal file
14
telephony/asterisk/patches/patch-channels_chan_sip_c
Normal file
@ -0,0 +1,14 @@
|
||||
$OpenBSD: patch-channels_chan_sip_c,v 1.4 2010/04/09 11:05:55 sthen Exp $
|
||||
|
||||
https://issues.asterisk.org/view.php?id=15827
|
||||
|
||||
--- channels/chan_sip.c.orig Wed Mar 3 00:19:57 2010
|
||||
+++ channels/chan_sip.c Fri Apr 9 11:56:12 2010
|
||||
@@ -3329,6 +3329,7 @@ static struct sip_proxy *proxy_allocate(char *name, ch
|
||||
proxy->force = force;
|
||||
ast_copy_string(proxy->name, name, sizeof(proxy->name));
|
||||
proxy->ip.sin_port = htons(port_str2int(port, STANDARD_SIP_PORT));
|
||||
+ proxy->ip.sin_family = AF_INET;
|
||||
proxy_update(proxy);
|
||||
return proxy;
|
||||
}
|
30
telephony/asterisk/patches/patch-include_asterisk_dnsmgr_h
Normal file
30
telephony/asterisk/patches/patch-include_asterisk_dnsmgr_h
Normal file
@ -0,0 +1,30 @@
|
||||
$OpenBSD: patch-include_asterisk_dnsmgr_h,v 1.1 2010/04/09 11:05:55 sthen Exp $
|
||||
|
||||
https://issues.asterisk.org/view.php?id=15827
|
||||
|
||||
--- include/asterisk/dnsmgr.h.orig Mon Mar 9 20:58:17 2009
|
||||
+++ include/asterisk/dnsmgr.h Fri Apr 9 10:46:27 2010
|
||||
@@ -42,12 +42,12 @@ struct ast_dnsmgr_entry;
|
||||
*
|
||||
* \param name the hostname
|
||||
* \param result where the DNS manager should store the IP address as it refreshes it.
|
||||
- * it.
|
||||
+ * \param service SRV prefix (optional, set to NULL to disable SRV)
|
||||
*
|
||||
* This function allocates a new DNS manager entry object, and fills it with the
|
||||
* provided hostname and IP address. This function does not force an initial lookup
|
||||
- * of the IP address. So, generally, this should be used when the initial address
|
||||
- * is already known.
|
||||
+ * of the IP address. So, this should be used when the initial address
|
||||
+ * is already known and stored in result.
|
||||
*
|
||||
* \return a DNS manager entry
|
||||
* \version 1.6.1 result changed from struct in_addr to struct sockaddr_in to store port number
|
||||
@@ -69,6 +69,7 @@ void ast_dnsmgr_release(struct ast_dnsmgr_entry *entry
|
||||
* \param name the hostname
|
||||
* \param result where to store the IP address as the DNS manager refreshes it
|
||||
* \param dnsmgr Where to store the allocate DNS manager entry
|
||||
+ * \param service SRV prefix (optional, set to NULL to disable SRV)
|
||||
*
|
||||
* This function allocates a new DNS manager entry object, and fills it with
|
||||
* the provided hostname and IP address. This function _does_ force an initial
|
14
telephony/asterisk/patches/patch-main_acl_c
Normal file
14
telephony/asterisk/patches/patch-main_acl_c
Normal file
@ -0,0 +1,14 @@
|
||||
$OpenBSD: patch-main_acl_c,v 1.1 2010/04/09 11:05:55 sthen Exp $
|
||||
|
||||
https://issues.asterisk.org/view.php?id=15827
|
||||
|
||||
--- main/acl.c.orig Thu Feb 25 22:42:53 2010
|
||||
+++ main/acl.c Fri Apr 9 10:46:27 2010
|
||||
@@ -387,6 +387,7 @@ int ast_get_ip_or_srv(struct sockaddr_in *sin, const c
|
||||
}
|
||||
}
|
||||
if ((hp = ast_gethostbyname(value, &ahp))) {
|
||||
+ sin->sin_family = hp->h_addrtype;
|
||||
memcpy(&sin->sin_addr, hp->h_addr, sizeof(sin->sin_addr));
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Unable to lookup '%s'\n", value);
|
95
telephony/asterisk/patches/patch-main_dnsmgr_c
Normal file
95
telephony/asterisk/patches/patch-main_dnsmgr_c
Normal file
@ -0,0 +1,95 @@
|
||||
$OpenBSD: patch-main_dnsmgr_c,v 1.1 2010/04/09 11:05:55 sthen Exp $
|
||||
|
||||
https://issues.asterisk.org/view.php?id=15827
|
||||
|
||||
--- main/dnsmgr.c.orig Mon Aug 10 20:36:38 2009
|
||||
+++ main/dnsmgr.c Fri Apr 9 10:46:27 2010
|
||||
@@ -52,8 +52,6 @@ static pthread_t refresh_thread = AST_PTHREADT_NULL;
|
||||
struct ast_dnsmgr_entry {
|
||||
/*! where we will store the resulting IP address and port number */
|
||||
struct sockaddr_in *result;
|
||||
- /*! the last result, used to check if address/port has changed */
|
||||
- struct sockaddr_in last;
|
||||
/*! SRV record to lookup, if provided. Composed of service, protocol, and domain name: _Service._Proto.Name */
|
||||
char *service;
|
||||
/*! Set to 1 if the entry changes */
|
||||
@@ -85,6 +83,9 @@ static struct refresh_info master_refresh_info = {
|
||||
.verbose = 0,
|
||||
};
|
||||
|
||||
+/*
|
||||
+ * Allocate a new DNS manager entry
|
||||
+ */
|
||||
struct ast_dnsmgr_entry *ast_dnsmgr_get(const char *name, struct sockaddr_in *result, const char *service)
|
||||
{
|
||||
struct ast_dnsmgr_entry *entry;
|
||||
@@ -96,7 +97,6 @@ struct ast_dnsmgr_entry *ast_dnsmgr_get(const char *na
|
||||
entry->result = result;
|
||||
ast_mutex_init(&entry->lock);
|
||||
strcpy(entry->name, name);
|
||||
- memcpy(&entry->last, result, sizeof(entry->last));
|
||||
if (service) {
|
||||
entry->service = ((char *) entry) + sizeof(*entry) + strlen(name);
|
||||
strcpy(entry->service, service);
|
||||
@@ -109,6 +109,9 @@ struct ast_dnsmgr_entry *ast_dnsmgr_get(const char *na
|
||||
return entry;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Free a DNS manager entry
|
||||
+ */
|
||||
void ast_dnsmgr_release(struct ast_dnsmgr_entry *entry)
|
||||
{
|
||||
if (!entry)
|
||||
@@ -123,6 +126,9 @@ void ast_dnsmgr_release(struct ast_dnsmgr_entry *entry
|
||||
ast_free(entry);
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Allocate a new DNS manager entry and perform the initial lookup before returning
|
||||
+ */
|
||||
int ast_dnsmgr_lookup(const char *name, struct sockaddr_in *result, struct ast_dnsmgr_entry **dnsmgr, const char *service)
|
||||
{
|
||||
if (ast_strlen_zero(name) || !result || !dnsmgr)
|
||||
@@ -133,8 +139,10 @@ int ast_dnsmgr_lookup(const char *name, struct sockadd
|
||||
|
||||
/* if it's actually an IP address and not a name,
|
||||
there's no need for a managed lookup */
|
||||
- if (inet_aton(name, &result->sin_addr))
|
||||
+ if (inet_aton(name, &result->sin_addr)) {
|
||||
+ result->sin_family = AF_INET;
|
||||
return 0;
|
||||
+ }
|
||||
|
||||
ast_verb(4, "doing dnsmgr_lookup for '%s'\n", name);
|
||||
|
||||
@@ -151,7 +159,7 @@ int ast_dnsmgr_lookup(const char *name, struct sockadd
|
||||
}
|
||||
|
||||
/*
|
||||
- * Refresh a dnsmgr entry
|
||||
+ * Force a refresh of a dnsmgr entry
|
||||
*/
|
||||
static int dnsmgr_refresh(struct ast_dnsmgr_entry *entry, int verbose)
|
||||
{
|
||||
@@ -164,15 +172,15 @@ static int dnsmgr_refresh(struct ast_dnsmgr_entry *ent
|
||||
if (verbose)
|
||||
ast_verb(3, "refreshing '%s'\n", entry->name);
|
||||
|
||||
- tmp.sin_port = entry->last.sin_port;
|
||||
+ memset(&tmp, 0, sizeof(tmp));
|
||||
+ tmp.sin_port = entry->result->sin_port;
|
||||
|
||||
- if (!ast_get_ip_or_srv(&tmp, entry->name, entry->service) && inaddrcmp(&tmp, &entry->last)) {
|
||||
- ast_copy_string(iabuf, ast_inet_ntoa(entry->last.sin_addr), sizeof(iabuf));
|
||||
+ if (!ast_get_ip_or_srv(&tmp, entry->name, entry->service) && inaddrcmp(&tmp, entry->result)) {
|
||||
+ ast_copy_string(iabuf, ast_inet_ntoa(entry->result->sin_addr), sizeof(iabuf));
|
||||
ast_copy_string(iabuf2, ast_inet_ntoa(tmp.sin_addr), sizeof(iabuf2));
|
||||
ast_log(LOG_NOTICE, "dnssrv: host '%s' changed from %s:%d to %s:%d\n",
|
||||
- entry->name, iabuf, ntohs(entry->last.sin_port), iabuf2, ntohs(tmp.sin_port));
|
||||
+ entry->name, iabuf, ntohs(entry->result->sin_port), iabuf2, ntohs(tmp.sin_port));
|
||||
*entry->result = tmp;
|
||||
- entry->last = tmp;
|
||||
changed = entry->changed = 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user