[Pkg-erlang-devel] Bug#585122: Please make epmd bindable to only loopback address

Joerg Dorchain joerg at dorchain.net
Wed Jun 9 10:53:44 UTC 2010


Package: erlang-base
Version: 1:13.b.4-dfsg-5
Severity: wishlist
Tags: upstream, patch

Hello,

when used in conjunction with ejabberd, I only need to run erlang
programs on one single machine. It seems advisable that in such
cases the epmd binds only to the loopback address. (a similiar
option for the rpc portmap daemon exists)

The following patch allows for such an option. This would make it
possible to start e.g. ejabberd with -epmd "epmd -loopback"

Bye,

Joerg
--- erts/epmd/src/epmd.c.orig	2010-06-09 11:12:51.000000000 +0200
+++ erts/epmd/src/epmd.c	2010-06-09 11:19:55.000000000 +0200
@@ -248,6 +248,7 @@
 
     g->silent         = 0; 
     g->is_daemon      = 0;
+    g->bind_loopback  = 0;
     g->packet_timeout = CLOSE_TIMEOUT; /* Default timeout */
     g->delay_accept   = 0;
     g->delay_write    = 0;
@@ -283,6 +284,9 @@
 	} else if (strcmp(argv[0], "-daemon") == 0) {
 	    g->is_daemon = 1;
 	    argv++; argc--;
+	} else if (strcmp(argv[0], "-loopback") == 0) {
+	    g->bind_loopback = 1;
+	    argv++; argc--;
 	} else if (strcmp(argv[0], "-kill") == 0) {
 	    if (argc == 1)
 		kill_epmd(g);
@@ -468,7 +472,7 @@
 
 static void usage(EpmdVars *g)
 {
-    fprintf(stderr, "usage: epmd [-d|-debug] [DbgExtra...] [-port No] [-daemon]\n");
+    fprintf(stderr, "usage: epmd [-d|-debug] [DbgExtra...] [-port No] [-daemon] [-loopback]\n");
     fprintf(stderr, "            [-d|-debug] [-port No] [-names|-kill]\n\n");
     fprintf(stderr, "See the Erlang epmd manual page for info about the usage.\n");
     fprintf(stderr, "The -port and DbgExtra options are\n\n");
--- erts/epmd/src/epmd_int.h.orig	2010-06-09 11:11:48.000000000 +0200
+++ erts/epmd/src/epmd_int.h	2010-06-09 11:12:32.000000000 +0200
@@ -316,6 +316,7 @@
   int debug;
   int silent; 
   int is_daemon;
+  int bind_loopback;
   unsigned packet_timeout;
   unsigned delay_accept;
   unsigned delay_write;
--- erts/epmd/src/epmd_srv.c.orig	2010-06-09 11:20:27.000000000 +0200
+++ erts/epmd/src/epmd_srv.c	2010-06-09 11:22:54.000000000 +0200
@@ -173,7 +173,10 @@
 
   { /* store port number in unsigned short */
     unsigned short sport = g->port;
-    SET_ADDR_ANY(iserv_addr, FAMILY, sport);
+    if (g->bind_loopback)
+    	SET_ADDR_LOOPBACK(iserv_addr, FAMILY, sport);
+    else
+	SET_ADDR_ANY(iserv_addr, FAMILY, sport);
   }
   
 #ifdef _OSE_
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 267 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-erlang-devel/attachments/20100609/68abba0b/attachment.pgp>


More information about the Pkg-erlang-devel mailing list