]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add force_local_ip_v4 and force_local_ip_v6 global vars to override the core funcs...
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 24 Feb 2010 18:13:28 +0000 (18:13 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 24 Feb 2010 18:13:28 +0000 (18:13 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16801 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_utils.c

index 0623e8a45fb1c1f5324792d8dfd6042d783efd70..c0aabcdcac334e551f078559deb79850fc51639b 100644 (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;
        }