aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authormnicholson <mnicholson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-06-17 15:11:27 +0000
committermnicholson <mnicholson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-06-17 15:11:27 +0000
commitacbda8c5b8550f5dd2eec7fd12b35426c4671a61 (patch)
tree41142dcbfcc956a3ff4e66ae5bdf47ed902e8ed3 /main
parentec79f7cd0daefeb0ede7503fc5d109f8b4c67a11 (diff)
Set sin_family in ast_get_ip_or_srv() and removed the 'last' member of the ast_dnsmgr_entry struct.
(closes issue #15827) Reported by: DennisD Patches: (modified) dnsmgr_15827.patch uploaded by chappell (license 8) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@271123 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/acl.c1
-rw-r--r--main/dnsmgr.c8
2 files changed, 3 insertions, 6 deletions
diff --git a/main/acl.c b/main/acl.c
index 5a7017da9..53eb0b996 100644
--- a/main/acl.c
+++ b/main/acl.c
@@ -395,6 +395,7 @@ int ast_get_ip_or_srv(struct sockaddr_in *sin, const char *value, const char *se
}
hp = ast_gethostbyname(value, &ahp);
if (hp) {
+ 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);
diff --git a/main/dnsmgr.c b/main/dnsmgr.c
index 6be5720d0..0dadb69d9 100644
--- a/main/dnsmgr.c
+++ b/main/dnsmgr.c
@@ -55,8 +55,6 @@ static pthread_t refresh_thread = AST_PTHREADT_NULL;
struct ast_dnsmgr_entry {
/*! where we will store the resulting address */
struct in_addr *result;
- /*! the last result, used to check if address has changed */
- struct in_addr last;
/*! Set to 1 if the entry changes */
int changed:1;
ast_mutex_t lock;
@@ -96,7 +94,6 @@ struct ast_dnsmgr_entry *ast_dnsmgr_get(const char *name, struct in_addr *result
entry->result = result;
ast_mutex_init(&entry->lock);
strcpy(entry->name, name);
- memcpy(&entry->last, result, sizeof(entry->last));
AST_LIST_LOCK(&entry_list);
AST_LIST_INSERT_HEAD(&entry_list, entry, list);
@@ -172,13 +169,12 @@ static int dnsmgr_refresh(struct ast_dnsmgr_entry *entry, int verbose)
if ((hp = ast_gethostbyname(entry->name, &ahp))) {
/* check to see if it has changed, do callback if requested (where de callback is defined ????) */
memcpy(&tmp, hp->h_addr, sizeof(tmp));
- if (tmp.s_addr != entry->last.s_addr) {
- ast_copy_string(iabuf, ast_inet_ntoa(entry->last), sizeof(iabuf));
+ if (tmp.s_addr != entry->result->s_addr) {
+ ast_copy_string(iabuf, ast_inet_ntoa(*entry->result), sizeof(iabuf));
ast_copy_string(iabuf2, ast_inet_ntoa(tmp), sizeof(iabuf2));
ast_log(LOG_NOTICE, "host '%s' changed from %s to %s\n",
entry->name, iabuf, iabuf2);
memcpy(entry->result, hp->h_addr, sizeof(entry->result));
- memcpy(&entry->last, hp->h_addr, sizeof(entry->last));
changed = entry->changed = 1;
}