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: https://origsvn.digium.com/svn/asterisk/branches/1.8@291758 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Paul Belanger
2010-10-14 15:15:12 +00:00
parent 27810a962e
commit a37956721c
6 changed files with 15 additions and 11 deletions

View File

@@ -220,10 +220,12 @@ struct ast_ha *ast_duplicate_ha_list(struct ast_ha *original);
* \param[out] ourip Our IP address is written here when it is found
* \param bindaddr A hint used for finding our IP. See the steps above for
* more details
* \param family Only addresses of the given family will be returned. Use 0
* or AST_SOCKADDR_UNSPEC to get addresses of all families.
* \retval 0 Success
* \retval -1 Failure
*/
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);
/*!
* \brief Convert a string to the appropriate COS value