add force_local_ip_v4 and force_local_ip_v6 global vars to override the core funcs to always discover the same ip

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16801 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2010-02-24 18:13:28 +00:00
parent e848e2e56c
commit 645edfe320
1 changed files with 18 additions and 0 deletions

View File

@ -980,6 +980,8 @@ SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int *ma
{
switch_status_t status = SWITCH_STATUS_FALSE;
char *base;
const char *force_local_ip_v4 = switch_core_get_variable("force_local_ip_v4");
const char *force_local_ip_v6 = switch_core_get_variable("force_local_ip_v6");
#ifdef WIN32
SOCKET tmp_socket;
@ -996,6 +998,22 @@ SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int *ma
char abuf[25] = "";
#endif
switch (family) {
case AF_INET:
if (force_local_ip_v4) {
switch_copy_string(buf, force_local_ip_v4, len);
}
return SWITCH_STATUS_SUCCESS;
case AF_INET6:
if (force_local_ip_v6) {
switch_copy_string(buf, force_local_ip_v6, len);
}
return SWITCH_STATUS_SUCCESS;
default:
break;
}
if (len < 16) {
return status;
}