From owner-freebsd-hackers@FreeBSD.ORG Thu Mar 31 03:20:44 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5588316A4CE for ; Thu, 31 Mar 2005 03:20:44 +0000 (GMT) Received: from mta13.adelphia.net (mta13.adelphia.net [68.168.78.44]) by mx1.FreeBSD.org (Postfix) with ESMTP id B0C9143D2F for ; Thu, 31 Mar 2005 03:20:43 +0000 (GMT) (envelope-from maksim.yevmenkin@savvis.net) Received: from [192.168.1.254] (really [70.32.199.60]) by mta13.adelphia.net (InterMail vM.6.01.04.01 201-2131-118-101-20041129) with ESMTP id <20050331032043.ZYFI4618.mta13.adelphia.net@[192.168.1.254]>; Wed, 30 Mar 2005 22:20:43 -0500 Message-ID: <424B6CA0.9060202@savvis.net> Date: Wed, 30 Mar 2005 19:21:04 -0800 From: Maksim Yevmenkin User-Agent: Mozilla Thunderbird 0.7.1 (Windows/20040626) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jerry Toung References: <200503301620.24086.jtoung@arc.nasa.gov> <424B50EC.1020502@savvis.net> <200503301907.15654.jtoung@arc.nasa.gov> In-Reply-To: <200503301907.15654.jtoung@arc.nasa.gov> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: hackers cc: Julian Elischer Subject: Re: netgraph TTY X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Mar 2005 03:20:44 -0000 Jerry Toung wrote: > Hey Max, > all I can say is thank you. That's a very nice tutorial. I am sure other > people will benefit. so, did i get job at nasa? :) btw, i did miss one command (naming one2many node) while cut-and-paste'ing this from my screen, i.e. >>+ mkpeer tee: one2many left2right many0 >>+ connect tee: tee:left2right right2left many1 + name tee:left2right one2many >>+ show one2many: thanks, max > Take care my friend. > Jerry > > On Wednesday 30 March 2005 05:22 pm, Maksim Yevmenkin wrote: > >>Jerry, >> >>draw a picture :) it really helps :) for example >> >> right2left left2right >> \ / >>[ksocket] ------- [tee] -------- [hole] >> left right >> >># ngctl >> >>+ mkpeer hole hook hook -- create ng_hole node >>+ name hook hole -- name ng_hole node >> >> >>+ mkpeer hole: tee right right -- create ng_tee node and connect to hole >>+ name hole:right tee -- name ng_tee node >> >> >>+ mkpeer tee: ksocket left local/stream/0 -- create ksocket node and >>connect to tee >>+ name tee:left ksocket -- name ksocket node >>+ msg ksocket: bind local/"/tmp/foo" -- bind ksocket >> >> >>+ show tee: >> Name: tee Type: tee ID: 00000011 Num hooks: 2 >> Local hook Peer name Peer type Peer ID Peer >>hook >> ---------- --------- --------- ------- >>--------- >> left ksocket ksocket 00000012 >>local/stream/0 >> right hole hole 00000010 right >> >> >> >>+ show ksocket: >> Name: ksocket Type: ksocket ID: 00000012 Num hooks: 1 >> Local hook Peer name Peer type Peer ID Peer >>hook >> ---------- --------- --------- ------- >>--------- >> local/stream/0 tee tee 00000011 left >> >> >> >>+ show hole: >> Name: hole Type: hole ID: 00000010 Num hooks: 2 >> Local hook Peer name Peer type Peer ID Peer >>hook >> ---------- --------- --------- ------- >>--------- >> right tee tee 00000011 right >> >> hook ngctl8529 socket 0000000f hook >> >> >> >>now connect nghook(8) to "tee:left2right" (or you could connect ng_tty >>node there), then connect to the unix socket at "/tmp/foo" and send >>something to the socket. you should see output. since we have ng_hole on >>the "right" then "right2left" will never get any data. if you need to >>capture traffic from from "right2left" then you will need to connect >>"one2many" node to both "right2left" (to "one2many:many0") and >>"right2left" (to "one2name:many1") and then connect your tty node to the >>"one2many:one" hook >> >>like so >> >>+ mkpeer tee: one2many left2right many0 >>+ connect tee: tee:left2right right2left many1 >>+ show one2many: >> Name: one2many Type: one2many ID: 00000014 Num hooks: 2 >> Local hook Peer name Peer type Peer ID Peer >>hook >> ---------- --------- --------- ------- >>--------- >> many1 tee tee 00000011 >>right2left >> many0 tee tee 00000011 >>left2right >> >> >>+ show tee: >> Name: tee Type: tee ID: 00000011 Num hooks: 4 >> Local hook Peer name Peer type Peer ID Peer >>hook >> ---------- --------- --------- ------- >>--------- >> right2left one2many one2many 00000014 many1 >> >> left2right one2many one2many 00000014 many0 >> >> left ksocket ksocket 00000012 >>local/stream/0 >> right hole hole 00000010 right >> >> >> >>hope this helps :) >> >>max