ng_tee, right2left, et al

Ceri Davies ceri at submonkey.net
Mon Oct 3 06:53:29 PDT 2005


On Mon, Oct 03, 2005 at 05:41:32PM +0400, Gleb Smirnoff wrote:

Hi Gleb,

> 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 only call it "wrong" as it didn't agree with Archie's article or my
expectations, hence the quotes - I realise that it's subjective.

It just seems to me that packets leaving left2right would go to right,
as the name implies.  I don't really mind either way, it's simply that
I found it confusing.

> 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.

Perhaps as I learn more about it I will come to agree ;-)  Thanks.

Ceri
-- 
Only two things are infinite, the universe and human stupidity, and I'm
not sure about the former.			  -- Einstein (attrib.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-net/attachments/20051003/222ceba2/attachment.bin


More information about the freebsd-net mailing list