mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 02:37:10 +00:00 
			
		
		
		
	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:
		| @@ -623,7 +623,7 @@ static int jingle_create_candidates(struct jingle *client, struct jingle_pvt *p, | ||||
| 	ast_rtp_instance_get_local_address(p->rtp, &sin_tmp); | ||||
| 	ast_sockaddr_to_sin(&sin_tmp, &sin); | ||||
| 	ast_sockaddr_from_sin(&bindaddr_tmp, &bindaddr); | ||||
| 	ast_find_ourip(&us_tmp, &bindaddr_tmp); | ||||
| 	ast_find_ourip(&us_tmp, &bindaddr_tmp, AF_INET); | ||||
| 	us.s_addr = htonl(ast_sockaddr_ipv4(&us_tmp)); | ||||
|  | ||||
| 	/* Setup our first jingle candidate */ | ||||
| @@ -1904,15 +1904,17 @@ static int load_module(void) | ||||
| 	} | ||||
|  | ||||
| 	sched = sched_context_create(); | ||||
| 	if (!sched)  | ||||
| 	if (!sched) { | ||||
| 		ast_log(LOG_WARNING, "Unable to create schedule context\n"); | ||||
| 	} | ||||
|  | ||||
| 	io = io_context_create(); | ||||
| 	if (!io)  | ||||
| 	if (!io) { | ||||
| 		ast_log(LOG_WARNING, "Unable to create I/O context\n"); | ||||
| 	} | ||||
|  | ||||
| 	ast_sockaddr_from_sin(&bindaddr_tmp, &bindaddr); | ||||
| 	if (ast_find_ourip(&ourip_tmp, &bindaddr_tmp)) { | ||||
| 	if (ast_find_ourip(&ourip_tmp, &bindaddr_tmp, AF_INET)) { | ||||
| 		ast_log(LOG_WARNING, "Unable to get own IP address, Jingle disabled\n"); | ||||
| 		return 0; | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user