From owner-freebsd-hackers Mon Jun 17 7:39: 6 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from harrier.mail.pas.earthlink.net (harrier.mail.pas.earthlink.net [207.217.120.12]) by hub.freebsd.org (Postfix) with ESMTP id 42A6E37B423 for ; Mon, 17 Jun 2002 07:39:03 -0700 (PDT) Received: from pool0073.cvx40-bradley.dialup.earthlink.net ([216.244.42.73] helo=mindspring.com) by harrier.mail.pas.earthlink.net with esmtp (Exim 3.33 #2) id 17Jxen-0005AP-00; Mon, 17 Jun 2002 07:39:01 -0700 Message-ID: <3D0DF45F.C616C7CA@mindspring.com> Date: Mon, 17 Jun 2002 07:38:23 -0700 From: Terry Lambert X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: gauthamg123list@myrealbox.com Cc: "FreeBSD.org - Hackers" Subject: Re: Inserting a kernel module b/w IP and ethernet References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 Gautham Ganapathy wrote: > How can I add an extra layer of processing b/w the IP and ethernet layers > using a kernel module ? If I load a module, I should be able to access the > functions exported by IP and ethernet. Also, I think the ethernet layer can > be configured to use my module as the protocol by patching ifconfig. Am I > right so far ? So, how do I get IP to use my module as it's link layer ? If > I am wrong, what's the proper way ? Or is there any other simpler way ? My > requirement is to add a compression layer (RFC 2507) Questions like this should probably be sent to -net, rather than -hackers. You will probably find a better answer than mine, just by searching the -net list archives at www.freebsd.org. The RFC specifically references a NetBSD implementation for PPP; is this for PPP? If it's for PPP, then mpd may have already implemented what you need as a netgraph node. One thing you aren't going to be able to do is BPF on input after netgraph catches the data. Don't bother with a protocol family, unless you want to have to implement everything; TCP in tcp_output() calls ip_output() directly, so you will not be able to wedge it in there (TCP and IP are not implemented as stackable protocol layers seperate and distinct from each other). I can point you at code that does this, but it requires changing your application in order to make it open sockets with the new family instead of AF_INET; if you ar adamant, the code is at Rice University, as part of the Scala Server Project. My particular choice for an example would be /sys/netgraph/ng_pppoe.c but others might point you to something else. Julian or Archie are always the best people to ask (obviously). You could also create an interface (see /sys/netgraph/ng_iface.c) that pretended to be a plain old interface, and did the encapsulation/deincapsulation, and sent to the regular interface. The basics are going to be that you replace the mbuf with your modified mbuf, rather than eating it outright, if you want the input/output processing to proceed normally on the (de)compressed packet. I don't know if there is a ng_null that anyone has written; it would *really* be the best starting point. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message