From owner-freebsd-questions Tue Dec 5 13:12:41 2000 From owner-freebsd-questions@FreeBSD.ORG Tue Dec 5 13:12:39 2000 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from berzerk.gpcc.itd.umich.edu (berzerk.gpcc.itd.umich.edu [141.211.2.162]) by hub.freebsd.org (Postfix) with ESMTP id 48F7037B400 for ; Tue, 5 Dec 2000 13:12:39 -0800 (PST) Received: from battlezone.gpcc.itd.umich.edu (smtp@battlezone.gpcc.itd.umich.edu [141.211.2.140]) by berzerk.gpcc.itd.umich.edu (8.8.8/4.3-mailhub) with ESMTP id QAA12005; Tue, 5 Dec 2000 16:12:38 -0500 (EST) Received: from localhost (timcm@localhost) by battlezone.gpcc.itd.umich.edu (8.8.8/5.1-client) with ESMTP id QAA02582; Tue, 5 Dec 2000 16:12:37 -0500 (EST) Date: Tue, 5 Dec 2000 16:12:37 -0500 (EST) From: Tim McMillen X-Sender: timcm@battlezone.gpcc.itd.umich.edu To: Chris Gage Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Writing a kernel module In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, 5 Dec 2000, Chris Gage wrote: > I've been looking, so far in vain, for some kind of guidelines about how I > would go about writing a kernel module for FreeBSD. What I need to do is > more or less what a firewall or a router does, ie intercept packets at the > lowest level inside IP and either return them to the stack if I don't want > them, or forward them to some other IP address if I do want them. If > anyone could point me to a place where this jewel of rather fundamental > information resides, I'd be very grateful. > Chris Gage -- IBM Corporation -- RTP, NC -- cgage@us.ibm.com -- (919) 254 > 5572 -- t/l 444 5572 Other people had asked this, but I had not seen replies so I thought there was nothing written about this. But I went to the google advanced search, restricted the domain to freebsd.org and searched for the exact phrase "kernel module" The first result is http://people.freebsd.org/~erich/ddwg/ddwg48.html Which is part of and gives a link to the FreeBSD device Driver Writers Guide which I didn't know existed. Other results from that search are probably good too. Of course you'll also want to get a hold of "The Design and Implementation of the 4.4BSD Operating System" by Kirk Mckusick if you don't already have it. And I just found this by looking at the tutorials page. The last three are fairly advanced and one links to: Dynamic Kernel Linker (KLD) Facility Programming Tutorial [Intro] http://www.daemonnews.org/200010/blueprints.html In the end the best way will be to look at the code from other KLD's and study the kernel code. Care to let us know what you are working on? Tim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message