From 4b773e2ed9bd72942e84d9dd4d00c9ab595d403d Mon Sep 17 00:00:00 2001
From: Richard Mudgett <rmudgett@digium.com>
Date: Wed, 8 Jun 2011 18:48:16 +0000
Subject: [PATCH] Merged revisions 322425 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r322425 | rmudgett | 2011-06-08 13:46:30 -0500 (Wed, 08 Jun 2011) | 16 lines

  SRV lookup attempted for SIP peers listed as an IP address.

  Asterisk attempts to SRV lookup a host name even if the host name is an IP
  address.  Regression introduced when IPv6 support was added.

  * Restored the check in ast_dnsmgr_lookup() to see if the given host name
  is an IP address.  The IP address could be in either IPv4 or IPv6 formats.

  (closes issue ASTERISK-17815)
  Reported by: Byron Clark
  Tested by: Byron Clark, Richard Mudgett
  Patches:
       issue19248_v1.8.patch - uploaded by Richard Mudgett (License #5621)

  Review: https://reviewboard.asterisk.org/r/1240/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@322426 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 main/dnsmgr.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/main/dnsmgr.c b/main/dnsmgr.c
index 23e1ab6ef6..9002ec87fe 100644
--- a/main/dnsmgr.c
+++ b/main/dnsmgr.c
@@ -131,6 +131,14 @@ int ast_dnsmgr_lookup(const char *name, struct ast_sockaddr *result, struct ast_
 		return 0;
 	}
 
+	/*
+	 * If it's actually an IP address and not a name, there's no
+	 * need for a managed lookup.
+	 */
+	if (ast_sockaddr_parse(result, name, 0)) {
+		return 0;
+	}
+
 	ast_verb(4, "doing dnsmgr_lookup for '%s'\n", name);
 
 	/* do a lookup now but add a manager so it will automagically get updated in the background */
-- 
GitLab