From owner-freebsd-hackers@FreeBSD.ORG Wed Apr 18 20:20:50 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C45F516A403 for ; Wed, 18 Apr 2007 20:20:50 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 3BAEA13C44C for ; Wed, 18 Apr 2007 20:20:50 +0000 (UTC) (envelope-from andre@freebsd.org) Received: (qmail 37973 invoked from network); 18 Apr 2007 19:44:35 -0000 Received: from dotat.atdotat.at (HELO [62.48.0.47]) ([62.48.0.47]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 18 Apr 2007 19:44:35 -0000 Message-ID: <46267DA0.6040901@freebsd.org> Date: Wed, 18 Apr 2007 22:20:48 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b) Gecko/20050217 MIME-Version: 1.0 To: stas.ibragimov@gmail.com References: <46265ec6.4bc81c47.0b0d.ffff97f3@mx.google.com> In-Reply-To: <46265ec6.4bc81c47.0b0d.ffff97f3@mx.google.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: Routing X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Apr 2007 20:20:50 -0000 stas.ibragimov@gmail.com wrote: > Hi, hackers :) In /usr/src/sys/netinet/tcp_output.c if function tcp_output() there are > code: error = ip_output(m, tp->t_inpcb->inp_options, NULL, ((so->so_options & > SO_DONTROUTE) ? IP_ROUTETOIF : 0), 0, tp->t_inpcb); In this function there are only one > call ip_output function, but struct route is null. I think, that more optimaly is to > keep the pointer to struct route in tcpcb.And not to search route every time, when > tcp_output called. We had what you describe in FreeBSD prior to version 5.2 and it was a mess. There were routing table pointers and references all over the place and when routes changed we had to scan all tcpcb's to nuke old references. Also the cached host information moved from the routing table to the tcp_hostcache. While the route loopup per segment send is a very small overhead it outweights the drawbacks of the previous system quite a bit. And the code is much nicer. -- Andre