From owner-freebsd-hackers Thu Nov 7 9:28:48 2002 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 ADF3137B401; Thu, 7 Nov 2002 09:28:45 -0800 (PST) Received: from scl8owa02.int.exodus.net (scl8out02.exodus.net [66.35.230.242]) by mx1.FreeBSD.org (Postfix) with ESMTP id AFCA643E6E; Thu, 7 Nov 2002 09:28:41 -0800 (PST) (envelope-from Maksim.Yevmenkin@exodus.net) Received: from scl8owa01.int.exodus.net ([66.35.230.241]) by scl8owa02.int.exodus.net with Microsoft SMTPSVC(5.0.2195.5329); Thu, 7 Nov 2002 09:28:41 -0800 Received: from exodus.net ([206.220.227.147]) by scl8owa01.int.exodus.net over TLS secured channel with Microsoft SMTPSVC(5.0.2195.5329); Thu, 7 Nov 2002 09:28:41 -0800 Message-ID: <3DCAA2C7.12D6ED3E@exodus.net> Date: Thu, 07 Nov 2002 09:28:39 -0800 From: Maksim Yevmenkin X-Mailer: Mozilla 4.78 [en] (X11; U; SunOS 5.7 sun4u) X-Accept-Language: en MIME-Version: 1.0 To: Steve Tremblett Cc: freebsd-net@FreeBSD.ORG, freebsd-hackers@FreeBSD.ORG Subject: Re: input source for network application References: <20021107121857.F264@sjt-u10.cisco.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 07 Nov 2002 17:28:41.0343 (UTC) FILETIME=[1D7E00F0:01C28683] Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Steve Tremblett wrote: > > I've been toying with the idea of tackling a Netgraph TCP/IP > implementation and want to hack out some skeleton netgraph nodes just > to feel things out and play around with parsing. I'm somewhat confused > on how to start. I'd like to be able to tinker as I go and I'd rather > not have to write 5000 lines of code and complete a mini-stack before > trying it out :) > > I'm in a bit of a bind. I want a sequence of ethernet frames to send > up through this framework. Hooking to ng_ether will give me this but I > am restricted to taking ALL frames (thus taking the machine offline) or > orphaned frames (where I will have to write some sort of traffic > generator to make frames of an invalid type). The third option here is > to hack ng_ether to deliver frames out the lower hook as well as up > into the kernel IP stack, thus giving me a complete stream without > taking the box offline. I've gotten libnet which seems to fit the bill > to generate any orphans I want, but making a stream of frames by hand > is a pain. why do you need ng_ether, ng_tee etc. at all? can't you just write your code with assumption that there will be one (or few) input hooks? can't you just connect *user-space* Ethernet/IP frame generator to the input hook(s) and send frames? that's what i did in HCI/Bluetooth stack when i had no *real* Bluetooth hardware. i just wrote simple *user-space* Bluetooth device simulator and connected it to the stack. then i run VMWare and debug my code. you can use tcpdump and save dumps to the file and then just read it and re-inject them into your node. this way you can test at least basic stuff, i.e. frame parsing etc. > I've read about ng_tee but haven't had an opportunity to play with it. > Could I hack together something like this for an input source? Would > this allow for uninterrupted operation of the workstation while also > giving a stream of test data? > > kernel > ip_input() > \ > \-| > |- upper hook-\ > ng_ether ng_tee----> > |- lower hook-/ > | > wire > > In case that diagram doesn't display in your mailer, I'm thinking of > connecting ng_tee to recieve input from ng_ether's lower hook and pass > it out through ng_ether's upper hook as well as into the input hook of > my own netgraph node. > > Does anyone have any suggestions or ideas on tools or methods to assist > me in starting this venture? Am I thinking about this problem from the > right angle or is my head up my ass? :) see above. max To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message