]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Bind to 0.0.0.0 instead of 127.0.0.1 by default; like most erlang nodes do.
authorAndrew Thompson <andrew@hijacked.us>
Mon, 23 Feb 2009 18:34:08 +0000 (18:34 +0000)
committerAndrew Thompson <andrew@hijacked.us>
Mon, 23 Feb 2009 18:34:08 +0000 (18:34 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12249 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/event_handlers/mod_erlang_event/ei_helpers.c
src/mod/event_handlers/mod_erlang_event/erlang_event.conf.xml
src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c

index ed9cf6028111943865fc9a91306c1af156fe0a7a..160a15c204ea60d5032f0a2b62ae3baeab24afaa 100644 (file)
@@ -316,6 +316,9 @@ switch_status_t initialise_ei(struct ei_cnode_s *ec)
 {
        switch_status_t rv;
        struct sockaddr_in server_addr;
+       struct hostent *nodehost;
+       char thishostname[EI_MAXHOSTNAMELEN+1] = "";
+       char thisnodename[MAXNODELEN+1];
 
        /* zero out the struct before we use it */
        memset(&server_addr, 0, sizeof(server_addr));
@@ -334,14 +337,13 @@ switch_status_t initialise_ei(struct ei_cnode_s *ec)
        server_addr.sin_family = AF_INET;
        server_addr.sin_port = htons(prefs.port);
        
-       struct hostent *nodehost = gethostbyaddr(&server_addr.sin_addr.s_addr, sizeof(server_addr.sin_addr.s_addr), AF_INET);
-       
-       char *thishostname = nodehost->h_name;
-       char thisnodename[MAXNODELEN+1];
+        if ((nodehost = gethostbyaddr(&server_addr.sin_addr.s_addr, sizeof(server_addr.sin_addr.s_addr), AF_INET)))
+               memcpy(thishostname, nodehost->h_name, EI_MAXHOSTNAMELEN);
        
-       if (!strcmp(thishostname, "localhost"))
+       if (switch_strlen_zero_buf(thishostname)) {
                gethostname(thishostname, EI_MAXHOSTNAMELEN);
-       
+       }
+
        if (prefs.shortname) {
                char *off;
                if ((off = strchr(thishostname, '.'))) {
index d71084ed3fbb184f5625c7df6c799fb2acd46880..c4b73bfae7aa3d2db2d6dc0c20fa9ca2755758fc 100644 (file)
@@ -1,6 +1,6 @@
 <configuration name="erlang_event.conf" description="Erlang Socket Client">
   <settings>
-    <param name="listen-ip" value="127.0.0.1"/>
+    <param name="listen-ip" value="0.0.0.0"/>
     <param name="listen-port" value="8031"/>
     <param name="cookie" value="ClueCon"/>
                <param name="shortname" value="true"/>
index 7ff8a5ea84c8534e5fe3fac55a021180c7f9e939..fb1504dbc6c0bb07ae994825c774ed82ea2d6599 100644 (file)
@@ -932,7 +932,7 @@ static int config(void)
        }
 
        if (switch_strlen_zero(prefs.ip)) {
-               set_pref_ip("127.0.0.1");
+               set_pref_ip("0.0.0.0");
        }
 
        if (switch_strlen_zero(prefs.cookie)) {
@@ -1423,7 +1423,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_erlang_event_runtime)
                }
        }
 
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connected and published erlang cnode at %s\n", ec.thisnodename);
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connected to epmd and published erlang cnode at %s\n", ec.thisnodename);
 
        listen_list.ready = 1;