Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Jul 2007 22:19:37 -0700 (PDT)
From:      Martha Pasikatan <magpasikat@yahoo.com>
To:        Julian Elischer <julian@elischer.org>, Alexander Motin <mav@freebsd.org>
Cc:        freebsd-net@freebsd.org, Martha Pasikatan <magpasikat@yahoo.com>
Subject:   Re: Sample Netgraph code that unhooks and rehooks without losing connection
Message-ID:  <862996.32073.qm@web44908.mail.sp1.yahoo.com>
In-Reply-To: <468999AD.3090907@elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Julian Elischer <julian@elischer.org> wrote: Alexander Motin wrote:
> Martha Pasikatan wrote:
>> I would like to be able to unhook a pppoe node hooked to link0 and 
>> rehook it to a tee node.  Can anyone give me a sample on how to do this?  
> 
> That's impossible. As soon as pppoe node hook is disconnected all 
> related info will be destroyed and session will be terminated. You 
> should put there some other node like ng_tee to prevent session 
> termination.
> 
That means I need to create another hook through make peer, right? Is that at the same path as link0? or inside link0?  

when you say link0, do you mean an ethernet side connection or a 
session-side connection?

a session-side connection
either way you can't do that because the act of removing the hook will
remove all the information for the session..
And the action of removing the ethernet hook will I think remove 
the whole node. This is however only an implementation detail.
Given a good enough reason I could  make a workaround..

Are some programs dependent on this behavior, because that might cause side-effects on them.  Is netgraph already widely-used by the way? 
Internally it would be in the form of either a new command 
similar to mkpeer like:

ngctl insert {node_type} 
             {target_node:}
             {target_hook}
             {insert_type_hook_a}
             {insert_type_hook_b}

or maybe a more specific version for tee-only.

ngctl 
mkpeer . tee any left2right
msg tee "insert" {target=some_node, hook=some_hook, side=left}

the hard part is that the locking gets really tricky..
you need to gain the locks on both sides of the  connection 
at the same time without having some sort of LOR style problems.

if we KNOW that the node being inserted is TEE and has no 
other users, then maybe we could take some shortcuts,
connecting the links up in an asymmetrical manner so that links being followed are 
always safe.

Would connecting it to a tee node allow me to forward the packets to another node, without disconnecting the session and at the same time, not have the session processed anymore by the previous node?  Is there already a functionality in netgraph that does this?  I might just not know about it but it already exist.   I could really use something like a divert function not just a copy.

       
---------------------------------
Yahoo! oneSearch: Finally,  mobile search that gives answers, not web links. 



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