Differences between netgraph nodes in 4.x and 5.x

Julian Elischer julian at elischer.org
Mon Jul 28 19:13:17 PDT 2003


Netgraph in 5.0 had to be alterred to support SMP locking.
at teh same time some 'simplificatiosn were made, however changing a
driver from one, to work witht he orther is relatively simple..

Major changes:
Instead of passing separate message and o-o-band data, both are 
attached to a single 'item' which is passed.
You need to keep track of, and free if neccesary, the 'item'.

You can extract the message and oob data from the 'item' simply,
using the macro's supplied..
In 4.x the functions take teh message and oob data separatly as
arguments. Ther eis no "item" so you don't need tr keep track of it.



In 5.x you can send a control message to whoever is on the other end of
a link. In 4.x you need to get the address and send it there.

If you want to send me the node you have writen I can 
make the diffs and send it back :-)


The init functions have very subtly changed

Instead of your init routine calling teh common code, it is called by
teh framework first so that it is already called bty teh time your
code is called. 


Examine the two "ng_sample.c" source files and examine the differences..


On Tue, 29 Jul 2003, Paolo Pisati wrote:

> 
> As the subject says,
> i developed a netgraph node (it's classifier node)
> using a 5.x box but tonight, i had a bad
> surprise: 
> 
> it seems the netgraph implemntation in 4.x and 5.x 
> are different, so now.
> 
> Could someone shed some light on the differences, please?
> 
> Thanks.
> 
> -- 
> 
> Paolo
> 
> GUFI: http://www.gufi.org
> 
> _______________________________________________
> freebsd-net at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"
> 



More information about the freebsd-net mailing list