From owner-freebsd-net@FreeBSD.ORG Thu Jan 22 08:57:06 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EA3F316A4CE for ; Thu, 22 Jan 2004 08:57:06 -0800 (PST) Received: from stewart.chicago.il.us (stewart.chicago.il.us [66.93.186.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7B4A243D1D for ; Thu, 22 Jan 2004 08:57:04 -0800 (PST) (envelope-from randall@stewart.chicago.il.us) Received: from stewart.chicago.il.us (stewart.chicago.il.us [127.0.0.1]) i0JCDQO6087874; Mon, 19 Jan 2004 06:13:27 -0600 (CST) (envelope-from randall@stewart.chicago.il.us) Message-ID: <400BC9E5.8010609@stewart.chicago.il.us> Date: Mon, 19 Jan 2004 06:13:25 -0600 From: "Randall R. Stewart (home)" User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.4) Gecko/20031008 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Poul-Henning Kamp References: <92245.1074513480@critter.freebsd.dk> In-Reply-To: <92245.1074513480@critter.freebsd.dk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: net@freebsd.org Subject: Re: Multihomed UDP server X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jan 2004 16:57:07 -0000 Poul-Henning Kamp wrote: >In message <20040119143315.N81347@news1.macomnet.ru>, Maxim Konovalov writes: > > >>On Mon, 19 Jan 2004, 12:07+0100, Poul-Henning Kamp wrote: >> >> >> >>>Simple question: >>> >>>Very simple UDP server daemon. >>> >>>Many clients (connect(2)'ing a socket for each is not an option) >>> >>>Multihomed machine. >>> >>>What's the simple trick to replying with the same source-IP as the >>>client used as destination-IP ? >>> >>> >>Probably bin/58012 worth to look (Multihomed tftpd enhancement). Yes, >>it relies on protocol but still. >> >> > >But that's not a general solution, and it certainly doesn't solve >the problem for my application. > >I'm considering ways to make sendmsg(2)/recvmsg(2) DTRT, and my >current candidate is give them a flag bit which says "msg_name has >both addresses". > > > Poul: One of the problems I think that is fundamental to BSD and multi-homing is the lack of supports for multiple-default routes. And even in O/S's that do support multiple default routes (aka Linux and winXP) they really don't deal with them correctly... If you have multiple default gateways (which you probably do if your multi-homed) what you really would like to do is use both of them. One way to do that, that would aid TCP (which probably does not help you) is to have built into the routing system a way to allocate a alternate route... That way when TCP starts hitting RTX-Timeouts it could do something like: newroute = rtalloc_alt(dst, tcb->old_rt); if ( newroute != tcb->old_rt && newroute) { RT_FREE(tcb->old_rt); tcb->old_rt = newroute } Now for TCP this would mean a more robust use of a multi-homed host.. For your situation you COULD use something like that but UDP would have to do a heck of a lot more than it currently does with routing .. which I think is zilch right now :--0 sigh... someday BSD's will decide to better support M-Homing.. for now hacks are appropriate :-/ R -- Randall R. Stewart 815-477-2127 (office) 815-342-5222 (cell phone)