From 1a629f8a54982fc50c01125690fe04b4aa2fa924 Mon Sep 17 00:00:00 2001 From: pabelanger Date: Thu, 14 Oct 2010 15:15:12 +0000 Subject: Add the ability for ast_find_ourip to return IPv4, IPv6 or both. While testing chan_gtalk I noticed jabber was using my IPv6 address and not IPv4. When using bindaddr=0.0.0.0 it is possible for ast_find_ourip() to return both IPv6 and IPv4 results. Adding a family parameter gives you the ablility to choose. Since jabber/gtalk/h323 do not support IPv6, we should only return IPv4 results. Review: https://reviewboard.asterisk.org/r/973/ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.8@291758 f38db490-d61c-443f-a65b-d21fe96a405b --- main/acl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'main/acl.c') diff --git a/main/acl.c b/main/acl.c index 1ca0cc0bd..dcbc3a965 100644 --- a/main/acl.c +++ b/main/acl.c @@ -720,7 +720,7 @@ int ast_ouraddrfor(const struct ast_sockaddr *them, struct ast_sockaddr *us) return 0; } -int ast_find_ourip(struct ast_sockaddr *ourip, const struct ast_sockaddr *bindaddr) +int ast_find_ourip(struct ast_sockaddr *ourip, const struct ast_sockaddr *bindaddr, int family) { char ourhost[MAXHOSTNAMELEN] = ""; struct ast_sockaddr root; @@ -735,7 +735,7 @@ int ast_find_ourip(struct ast_sockaddr *ourip, const struct ast_sockaddr *bindad if (gethostname(ourhost, sizeof(ourhost) - 1)) { ast_log(LOG_WARNING, "Unable to get hostname\n"); } else { - if (resolve_first(ourip, ourhost, PARSE_PORT_FORBID, 0) == 0) { + if (resolve_first(ourip, ourhost, PARSE_PORT_FORBID, family) == 0) { return 0; } } -- cgit v1.2.3