ng_tee, right2left, et al

Gleb Smirnoff glebius at FreeBSD.org
Mon Oct 3 06:41:37 PDT 2005


  Ceri,

On Mon, Oct 03, 2005 at 02:07:31PM +0100, Ceri Davies wrote:
C> I've discovered an application for which netgraph looks perfect, so have
C> just started reading the docs whilst paying proper attention.  I started
C> out with ng_tee as it looked the simplest, but I've found myself
C> confused already.
C> 
C> The manpage for ng_tee says:
C> 
C>  Tee nodes have four hooks, right, left, right2left, and left2right.
C>  All data received on right is sent unmodified to both hooks left and
C>  right2left.  Similarly, all data received on left is sent unmodified
C>  to both right and left2right.
C> 
C>  Packets may also be received on right2left and left2right; if so, they
C>  are forwarded unchanged out hooks right and left, respectively.
C> 
C> Now that last bit looked wrong to me; I would have though that a packet
C> received on right2left would be copied to left.  Checking the code shows
C> that the manpage is correct, though Archie Cobbs' article at
C> http://ezine.daemonnews.org/200003/netgraph.html says that the opposite
C> is true.
C> 
C> Is this behaviour that was changed for some reason, or has it always
C> been "wrong"?

I don't understand why you call current behavior wrong. I think that this is
intuitive, that any packet received on "left side of the node" will be
forwarded to hook right. As well as any packets received on "right side of the
node" will be forwarded to hook left.

I've checked Archie's article. What is said here is not true nowadays. You are
right, before revision 1.17 of ng_tee.c the node treated l2r and r2l hooks
counterwise. There is no comment, why Julian has changed the behavior. However,
I agree with him. The current behavior is more intuitive.

-- 
Totus tuus, Glebius.
GLEBIUS-RIPN GLEB-RIPE


More information about the freebsd-net mailing list