Re: [Nbd] Specifying interface to listen on
- To: Tefnet Developers <developers@...136...>
- Cc: nbd-general@lists.sourceforge.net
- Subject: Re: [Nbd] Specifying interface to listen on
- From: Wouter Verhelst <w@...112...>
- Date: Thu, 27 Sep 2007 12:41:28 +0200
- Message-id: <20070927104128.GB31306@...39...>
- In-reply-to: <1190887834.3295.21.camel@...137...>
- References: <1190887834.3295.21.camel@...137...>
On Thu, Sep 27, 2007 at 12:10:34PM +0200, Tefnet Developers wrote:
> Hi,
>
> nbd-server lacks ability to specify the IP address to listen on. For
> example, I have a server with a public IP and a private one (on a LAN).
> I would like nbd-server to serve only on a private network. Attached
> patch adds this functionality.
Yes, that makes sense.
[...]
> @@ -424,6 +427,14 @@
> /* non-option argument */
> switch(nonspecial++) {
> case 0:
> + colon=strchr(optarg, ':');
Please use g_strsplit for this type of thing
> @@ -1443,7 +1457,12 @@
> DEBUG("Waiting for connections... bind, ");
> addrin.sin_family = AF_INET;
> addrin.sin_port = htons(serve->port);
> - addrin.sin_addr.s_addr = 0;
> +
> + hen=gethostbyname(serve->host);
It's probably safer to not do DNS resolving here; think DNS poisoning.
IP addresses of servers rarely change, and when you're configuring a
server, it's safe to assume that you know its IP address.
Please also provide patches to the SGML files of the manpages.
--
<Lo-lan-do> Home is where you have to wash the dishes.
-- #debian-devel, Freenode, 2004-09-22
Reply to: