From owner-freebsd-net@FreeBSD.ORG Tue Jul 28 13:38:19 2009 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76C88106568C for ; Tue, 28 Jul 2009 13:38:19 +0000 (UTC) (envelope-from os@sfedu.ru) Received: from mail.r61.net (mail.r61.net [195.208.245.249]) by mx1.freebsd.org (Postfix) with ESMTP id E44CB8FC13 for ; Tue, 28 Jul 2009 13:38:18 +0000 (UTC) (envelope-from os@sfedu.ru) Received: from [195.208.252.154] (brain.cc.rsu.ru [195.208.252.154]) (authenticated bits=0) by mail.r61.net (8.14.3/8.14.1) with ESMTP id n6SDcCFT012087 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 28 Jul 2009 17:38:13 +0400 (MSD) (envelope-from os@sfedu.ru) X-Authentication-Warning: asterix.r61.net: Host brain.cc.rsu.ru [195.208.252.154] claimed to be [195.208.252.154] From: Oleg Sharoyko To: Julian Elischer In-Reply-To: <4A6E3743.7050708@elischer.org> References: <1248704237.96833.127.camel@brain.cc.rsu.ru> <4A6DE356.6040006@elischer.org> <4A6DEE30.6000108@sfedu.ru> <4A6DFFA1.1010709@elischer.org> <4A6E0121.2020004@sfedu.ru> <4A6E05EC.8050401@elischer.org> <4A6E0A8B.5000103@sfedu.ru> <4A6E2666.2040906@elischer.org> <4A6E3743.7050708@elischer.org> Content-Type: text/plain Date: Tue, 28 Jul 2009 17:38:12 +0400 Message-Id: <1248788292.71222.10.camel@brain.cc.rsu.ru> Mime-Version: 1.0 X-Mailer: Evolution 2.24.5 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: freebsd-net@freebsd.org Subject: Re: Wrong outgoing interface with multiple routing tables 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, 28 Jul 2009 13:38:19 -0000 On Mon, 2009-07-27 at 16:24 -0700, Julian Elischer wrote: > > in addition to the patches already sent you might like to add the > > following line to netinet/tcp_input.c > > > > } > > inc.inc_fport = th->th_sport; > > inc.inc_lport = th->th_dport; > > inc.inc_fibnum = so->so_fibnum; <------------- > > /* > > * Check for an existing connection attempt in syncache if > > * the flag is only ACK. A successful lookup creates a new > > * socket appended to the listen queue in SYN_RECEIVED > > state. > > */ > > in fact you might try just this on its own With this patch alone all the packets but SYN+ACK are being sent out correctly. SYN+ACK still uses wrong interface. ip_output() uses struct inpcb *inp argument to set fib. But when syncache_respond() sends SYN+ACK, ip_output() is being called without inp (from netinet/tcp_syncache.c, syncache_respond()): error = ip_output(m, sc->sc_ipopts, NULL, 0, NULL, NULL); It I add M_SETFIB(m, sc->sc_inc.inc_fibnum); before the call to ip_output(), then SYN+ACK goes the right way. -- Oleg Sharoyko. Software and Network Engineer Computer Center of Rostov State University.