Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Jun 2002 07:38:23 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        gauthamg123list@myrealbox.com
Cc:        "FreeBSD.org - Hackers" <freebsd-hackers@freebsd.org>
Subject:   Re: Inserting a kernel module b/w IP and ethernet
Message-ID:  <3D0DF45F.C616C7CA@mindspring.com>
References:  <NGBBJAAOCMHHCAAOGNFMMEFECDAA.gauthamg123list@myrealbox.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3D0DF45F.C616C7CA>