From owner-freebsd-net@FreeBSD.ORG Tue Jul 3 05:19:38 2007 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 481B416A400 for ; Tue, 3 Jul 2007 05:19:38 +0000 (UTC) (envelope-from magpasikat@yahoo.com) Received: from web44908.mail.sp1.yahoo.com (web44908.mail.sp1.yahoo.com [68.180.197.110]) by mx1.freebsd.org (Postfix) with SMTP id 2F5AC13C4AE for ; Tue, 3 Jul 2007 05:19:38 +0000 (UTC) (envelope-from magpasikat@yahoo.com) Received: (qmail 32632 invoked by uid 60001); 3 Jul 2007 05:19:37 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=ArAGV9FINcWeN7tguYVbhOtTEL/Bn1TQGT7VVVoB4Wub0Gx1jJn3wgv94IR5E3d8aBj4LgGK9sdfujNi7ds3Gfc3UKzqgr2lKzMgbl9luDFg+TeupL/qnyKKqOa/V9BDRcnoUDYxKSZuapu6dHo6hCMPsiDCgBOnk1q+W2BnCdE=; X-YMail-OSG: ht0PfCoVM1n5VVqgnbc4SKco3207VPQqpFyi_j.M8SEkuOP_qSAJVccVuRb9bI_ZIm12Q1DaQyAZlITh2ke06gf2ioKiiGjladk- Received: from [58.71.34.138] by web44908.mail.sp1.yahoo.com via HTTP; Mon, 02 Jul 2007 22:19:37 PDT Date: Mon, 2 Jul 2007 22:19:37 -0700 (PDT) From: Martha Pasikatan To: Julian Elischer , Alexander Motin In-Reply-To: <468999AD.3090907@elischer.org> MIME-Version: 1.0 Message-ID: <862996.32073.qm@web44908.mail.sp1.yahoo.com> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-net@freebsd.org, Martha Pasikatan Subject: Re: Sample Netgraph code that unhooks and rehooks without losing connection X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2007 05:19:38 -0000 Julian Elischer 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.