[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] Specifying interface to listen on



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: