mailing list archives
Re: Implementation sketch for Ncat caretaker processes
From: venkat sanaka <venkatsanaka () gmail com>
Date: Sun, 15 Nov 2009 02:52:50 +0530
The above technique costs two processes per connection. You could do it
with less overhead if you create the pipes and fork a subprocess when a
connection is received, then add the read end of the pipe connected to
stdout of the child process to the select set. When select indicates
that a decriptor is ready, there would be four cases:
1. The listening socket
2. A connected client socket.
3. The server's own stdin.
4. The stdout of a child process.
In case 2, you would read from the socket and write to the pipe of its
corresponding process. In case 4, you would read from the pipe and write
to its corresponding socket.
This approach will have a overhead of maintaining the pipe information
corresponding to a socket and retrieving it in case 2 for writing to the
In case 4, we use the same pipe info to check whether the ready descriptor
is, stdout of child process(read end of the pipe) or not.
I too think, this technique has less overhead when compared to the other
We need to change the existing read and write functions, where reading
from only STDIN and writing to all connected sockets(broadcast) is happening
as of now.Also we have to add pipe info to fdinfo struct present in util.h,
I am working on this approach and it's almost done.I will commit it to my
nmap-exp branch for your review, after testing it once.
Sent through the nmap-dev mailing list
Archived at http://seclists.org/nmap-dev/