retitle 532573 olsrd: olsrd_dot_draw: please add support for a "listen" 
parameter
severity 532573 wishlist
thanks

Hi again,

(Cc'ed the Debian bug report again - the following has been discussed on
olsr-dev.)

On Tue, Aug 04, 2009 at 12:56:52PM +0200, Sebastian Harl wrote:
> On Tue, Aug 04, 2009 at 12:07:17PM +0200, Henning Rogge wrote:
> > I don't think this patch will change the behaviour of dotdraw, because the 
> > ip 
> > is checked after the accept() command. See line 266 to 270 in 
> > olsrd_dot_draw.c
> 
> Uh, I'm sorry - for some reason I seem to have misinterpreted the
> "accept" parameter ...
> 
> My patch _does_ change the behavior of dotdraw - it lets the plugin bind
> to the specified IP only. However, instead of using the value of the
> "accept" parameter it should imho introduce a new parameter "listen" (or
> something like that). I'll provide an updated patch in a second.

An updated patch has been attached to this E-mail. As with the previous
patch, it requires s/\<addr\>/sin/ to apply against 0.5.6 (the patch is
against current upstream tip).

Again, sorry for the confusion!

Cheers,
Sebastian

PS: Henning, thanks for catching this!

-- 
Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/

Those who would give up Essential Liberty to purchase a little Temporary
Safety, deserve neither Liberty nor Safety.         -- Benjamin Franklin

# HG changeset patch
# User Sebastian Harl <[email protected]>
# Date 1249385992 -7200
# Node ID d774f6a493a342f737b88b9fbb627c6b59248b71
# Parent  60c58a40be911287edac40b0e3d368ec0b511587
olsrd_dot_draw: Introduced the "listen" parameter.

This paramter may be used to specify the IP to which the plugin is supposed to
bind to. It defaults to INADDR_ANY, so, by default, the previous behavior has
not been changed.

diff -r 60c58a40be91 -r d774f6a493a3 lib/dot_draw/src/olsrd_dot_draw.c
--- a/lib/dot_draw/src/olsrd_dot_draw.c	Wed Jul 22 00:32:12 2009 +0200
+++ b/lib/dot_draw/src/olsrd_dot_draw.c	Tue Aug 04 13:39:52 2009 +0200
@@ -204,7 +204,7 @@
   /* complete the socket structure */
   memset(&addr, 0, sizeof(addr));
   addr.sin_family = AF_INET;
-  addr.sin_addr.s_addr = INADDR_ANY;
+  addr.sin_addr.s_addr = ipc_listen_ip.v4.s_addr;
   addr.sin_port = htons(ipc_port);
 
   /* bind the socket to the port number */
diff -r 60c58a40be91 -r d774f6a493a3 lib/dot_draw/src/olsrd_dot_draw.h
--- a/lib/dot_draw/src/olsrd_dot_draw.h	Wed Jul 22 00:32:12 2009 +0200
+++ b/lib/dot_draw/src/olsrd_dot_draw.h	Tue Aug 04 13:39:52 2009 +0200
@@ -49,6 +49,7 @@
 #include "plugin.h"
 #include "plugin_util.h"
 
+extern union olsr_ip_addr ipc_listen_ip;
 extern union olsr_ip_addr ipc_accept_ip;
 extern int ipc_port;
 
diff -r 60c58a40be91 -r d774f6a493a3 lib/dot_draw/src/olsrd_plugin.c
--- a/lib/dot_draw/src/olsrd_plugin.c	Wed Jul 22 00:32:12 2009 +0200
+++ b/lib/dot_draw/src/olsrd_plugin.c	Tue Aug 04 13:39:52 2009 +0200
@@ -61,6 +61,7 @@
 #define MOD_DESC PLUGIN_NAME " " PLUGIN_VERSION " by " PLUGIN_AUTHOR
 #define PLUGIN_INTERFACE_VERSION 5
 
+union olsr_ip_addr ipc_listen_ip;
 union olsr_ip_addr ipc_accept_ip;
 int ipc_port;
 
@@ -80,6 +81,7 @@
   /* defaults for parameters */
   ipc_port = 2004;
   ipc_accept_ip.v4.s_addr = htonl(INADDR_LOOPBACK);
+  ipc_listen_ip.v4.s_addr = INADDR_ANY;
 }
 
 
@@ -109,6 +111,7 @@
 static const struct olsrd_plugin_parameters plugin_parameters[] = {
   {.name = "port",.set_plugin_parameter = &set_plugin_port,.data = &ipc_port},
   {.name = "accept",.set_plugin_parameter = &set_plugin_ipaddress,.data = &ipc_accept_ip},
+  {.name = "listen",.set_plugin_parameter = &set_plugin_ipaddress,.data = &ipc_listen_ip},
 };
 
 void

Attachment: signature.asc
Description: Digital signature

Reply via email to