Nmap Development mailing list archives
Re: Implementation sketch for Ncat caretaker processes
From: David Fifield <david () bamsoftware com>
Date: Mon, 16 Nov 2009 01:30:03 -0700
On Sun, Nov 15, 2009 at 02:52:50AM +0530, venkat sanaka wrote:
The above technique costs two processes per connection. You could do itwith 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 pipe. 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 one. 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.
Excellent. I'm looking forward to seeing it. Forking an extra process per client would be easy and have a small impact on the code, but I would prefer this technique if it doesn't complicate things too much. David Fifield _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- Ncat for Netcat users Ron (Nov 04)
- Re: Ncat for Netcat users Fyodor (Nov 06)
- Re: Ncat for Netcat users David Fifield (Nov 06)
- Re: Ncat for Netcat users venkat sanaka (Nov 06)
- Implementation sketch for Ncat caretaker processes David Fifield (Nov 06)
- Re: Implementation sketch for Ncat caretaker processes venkat sanaka (Nov 14)
- Re: Implementation sketch for Ncat caretaker processes David Fifield (Nov 16)
- Re: Ncat for Netcat users David Fifield (Nov 06)
- Re: Ncat for Netcat users Fyodor (Nov 06)