From owner-freebsd-net@FreeBSD.ORG Tue Jul 3 18:18:01 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 48F3A16A400 for ; Tue, 3 Jul 2007 18:18:01 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outG.internet-mail-service.net (outG.internet-mail-service.net [216.240.47.230]) by mx1.freebsd.org (Postfix) with ESMTP id 347A613C44C for ; Tue, 3 Jul 2007 18:18:01 +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; Tue, 03 Jul 2007 11:18:00 -0700 Received: from julian-mac.elischer.org (nat.ironport.com [63.251.108.100]) by idiom.com (Postfix) with ESMTP id EF9F9125B31; Tue, 3 Jul 2007 11:17:59 -0700 (PDT) Message-ID: <468A92E4.8040201@elischer.org> Date: Tue, 03 Jul 2007 11:18:12 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.4 (Macintosh/20070604) MIME-Version: 1.0 To: Martha Pasikatan References: <862996.32073.qm@web44908.mail.sp1.yahoo.com> In-Reply-To: <862996.32073.qm@web44908.mail.sp1.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-net@freebsd.org, Alexander Motin 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 18:18:01 -0000 your mail was ZVERY hard to read becosue you mixed you comments in with my mail without distinguishing them in any way.. I missed two of them on first reading. Martha Pasikatan wrote: > 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? I believe he means you need to add the tee at creation time. "just in case". > Are some programs dependent on this behavior, because that might cause > side-effects on them. Is netgraph already widely-used by the way? yes. it is used by a lot of people for all kinds of strange things. > > 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. probably another kind of node would be better for that. maybe you could use a bpf node, or possibly one of the one2many modes may be good for you. Possibly you could write a new note type. "switchpoint" which can be switched from one connection to another using a command message. New netgraph types are very easy to write. The ng_sample.c file is a good starting point. take some of the logic from tee and some of the message handling from one2many (mode setting messages) and grapfdt them together into a node that does what you want exactly. (but first look at all the nodes that already exist to see if one doesn't already do what you want).