From owner-freebsd-hackers Thu Oct 17 13:48:25 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 617DB37B401; Thu, 17 Oct 2002 13:48:23 -0700 (PDT) Received: from snipe.mail.pas.earthlink.net (snipe.mail.pas.earthlink.net [207.217.120.62]) by mx1.FreeBSD.org (Postfix) with ESMTP id E4D9743E8A; Thu, 17 Oct 2002 13:48:22 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from pool0289.cvx22-bradley.dialup.earthlink.net ([209.179.199.34] helo=mindspring.com) by snipe.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 182HZ5-0002TA-00; Thu, 17 Oct 2002 13:48:19 -0700 Message-ID: <3DAF21CA.60031059@mindspring.com> Date: Thu, 17 Oct 2002 13:47:06 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Vincent Jardin Cc: freebsd-net@freebsd.org, freebsd-hackers@freebsd.org Subject: Re: Netgraph TCP/IP References: <20021017110456.G15035@sjt-u10.cisco.com> <3DAF087C.7B148341@mindspring.com> <20021017200111.E98171503A0@venus.vincentjardin.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Vincent Jardin wrote: > I do not think that you need a raw IP netgraph node. Something similar > already exists. Why not use the ng_ksocket in order to open a raw IP socket > under your TCP node ? Because the packet will never get to your protocol processing, unless you turn of standard TCP altogether, and even then, the pr_input will not do the right thing for chaining the data up to a Netgraph node. ip_input.c: ... if (args.next_hop && ip->ip_p == IPPROTO_TCP) { /* TCP needs IPFORWARD info if available */ struct m_hdr tag; tag.mh_type = MT_TAG; tag.mh_flags = PACKET_TAG_IPFORWARD; tag.mh_data = (caddr_t)args.next_hop; tag.mh_next = m; (*inetsw[ip_protox[ip->ip_p]].pr_input)( (struct mbuf *)&tag, hlen); } else (*inetsw[ip_protox[ip->ip_p]].pr_input)(m, hlen); ... For this to work, you have to have a pr_input that glues into a Netgraph entry point, so that IP packets of a specific protocol type captured by the Netgraph node get passed to it. There is also the m_pullup() issue of the TCP protocol that is being passed IP datagrams which may be frags of TCP packets, in order to get the full TCP header, with options. Minimally, the approach has to be a seperate TCP stack, which is given a different protocol number for the purposes of experiment, so that you can have a duplicate TCP stack on both sides using the normal mechanism, and replace it on one side with the Netgraph version equivalen. See the LRP implementation from Rice University, or the updated port by Duke University. They both use this approach to run a stack, and other primitives, in paralell on the system. That is also why the code, as it sits in their source bases, would take some work to integrate fully into FreeBSD (license issues aside) as the default protocol processing path. Actually, it would take much longer now that the SYN cache and the polling code has obfuscated things. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message