From fae952def3698b588b96231862123ee3547c702e Mon Sep 17 00:00:00 2001 From: Steven Danna Date: Tue, 14 Nov 2017 21:08:05 +0000 Subject: [PATCH] epmd: require explicitly adding address Based on the following PR: https://github.com/erlang/otp/pull/1075/commits/0800214dc6aec5327f4e984047dd05a8829ae5e4 --- erts/epmd/src/epmd_srv.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/erts/epmd/src/epmd_srv.c b/erts/epmd/src/epmd_srv.c index e1bac99ef9..f42a97330e 100644 --- a/erts/epmd/src/epmd_srv.c +++ b/erts/epmd/src/epmd_srv.c @@ -257,14 +257,6 @@ void run(EpmdVars *g) char *tmp = NULL; char *token = NULL; - /* Always listen on the loopback. */ - SET_ADDR(iserv_addr[num_sockets],htonl(INADDR_LOOPBACK),sport); - num_sockets++; -#if defined(EPMD6) - SET_ADDR6(iserv_addr[num_sockets],in6addr_loopback,sport); - num_sockets++; -#endif - if ((tmp = strdup(g->addresses)) == NULL) { dbg_perror(g,"cannot allocate memory"); @@ -278,7 +270,6 @@ void run(EpmdVars *g) struct in_addr addr; #if defined(EPMD6) struct in6_addr addr6; - struct sockaddr_storage *sa = &iserv_addr[num_sockets]; if (inet_pton(AF_INET6,token,&addr6) == 1) { @@ -301,15 +292,6 @@ void run(EpmdVars *g) epmd_cleanup_exit(g,1); } -#if defined(EPMD6) - if (sa->ss_family == AF_INET6 && IN6_IS_ADDR_LOOPBACK(&addr6)) - continue; - - if (sa->ss_family == AF_INET) -#endif - if (IS_ADDR_LOOPBACK(addr)) - continue; - num_sockets++; if (num_sockets >= MAX_LISTEN_SOCKETS) @@ -374,13 +356,24 @@ void run(EpmdVars *g) switch (errno) { case EAFNOSUPPORT: case EPROTONOSUPPORT: + /* + * Log error but continue. We can get here for + * in6addr_any on machines that don't have IPv6 + * support. If we can't bind any addresses, we'll + * exit further down + * + */ + dbg_perror(g,"error opening stream socket"); continue; default: dbg_perror(g,"error opening stream socket"); epmd_cleanup_exit(g,1); } } - g->listenfd[bound++] = listensock[i]; + else + { + g->listenfd[bound++] = listensock[i]; + } #if HAVE_DECL_IPV6_V6ONLY opt = 1; -- 2.14.1