From owner-freebsd-net@FreeBSD.ORG Tue Jul 3 00:42:29 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 1B0F416A400 for ; Tue, 3 Jul 2007 00:42:29 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outW.internet-mail-service.net (outW.internet-mail-service.net [216.240.47.246]) by mx1.freebsd.org (Postfix) with ESMTP id 07F8513C457 for ; Tue, 3 Jul 2007 00:42:29 +0000 (UTC) (envelope-from julian@elischer.org) Received: from mx0.idiom.com (HELO idiom.com) (216.240.32.160) by out.internet-mail-service.net (qpsmtpd/0.32) with ESMTP; Mon, 02 Jul 2007 17:42:28 -0700 Received: from julian-mac.elischer.org (nat.ironport.com [63.251.108.100]) by idiom.com (Postfix) with ESMTP id 127D9125BE0; Mon, 2 Jul 2007 17:34:43 -0700 (PDT) Message-ID: <468999AD.3090907@elischer.org> Date: Mon, 02 Jul 2007 17:34:53 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.4 (Macintosh/20070604) MIME-Version: 1.0 To: Alexander Motin References: <1183389786.00767485.1183376402@10.7.7.3> <46896330.7070000@freebsd.org> In-Reply-To: <46896330.7070000@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 00:42:29 -0000 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. > when you say link0, do you mean an ethernet side connection or 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.. 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.