From owner-freebsd-net Thu Nov 21 17:57:18 2002 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 1D25437B404 for ; Thu, 21 Nov 2002 17:57:15 -0800 (PST) Received: from InterJet.dellroad.org (adsl-63-194-81-26.dsl.snfc21.pacbell.net [63.194.81.26]) by mx1.FreeBSD.org (Postfix) with ESMTP id 537CE43E97 for ; Thu, 21 Nov 2002 17:57:14 -0800 (PST) (envelope-from archie@dellroad.org) Received: from arch20m.dellroad.org (arch20m.dellroad.org [10.1.1.20]) by InterJet.dellroad.org (8.9.1a/8.9.1) with ESMTP id RAA86207; Thu, 21 Nov 2002 17:57:09 -0800 (PST) Received: from arch20m.dellroad.org (localhost [127.0.0.1]) by arch20m.dellroad.org (8.12.6/8.12.6) with ESMTP id gAM1v9OS068554; Thu, 21 Nov 2002 17:57:09 -0800 (PST) (envelope-from archie@arch20m.dellroad.org) Received: (from archie@localhost) by arch20m.dellroad.org (8.12.6/8.12.6/Submit) id gAM1v2Ls068553; Thu, 21 Nov 2002 17:57:02 -0800 (PST) From: Archie Cobbs Message-Id: <200211220157.gAM1v2Ls068553@arch20m.dellroad.org> Subject: Re: Sockets and changing IP addresses In-Reply-To: <3DDD4D11.15376311@softweyr.com> To: Wes Peters Date: Thu, 21 Nov 2002 17:57:02 -0800 (PST) Cc: freebsd-net@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL99b (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Wes Peters wrote: > > I'm curious what -net's opinion is on PR kern/38544: > > > > http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/38554 > > > > In summary: if you have a connected socket whose local IP address > > is X, and then change the interface IP address from X to Y, then > > packets written out by the socket will continue to be transmitted > > with source IP address X. > > > > Do people agree that this is a bug and should be fixed? > > Yes. The other end can't possibly reply to address X, so the connection > is broken at this point. Now I've got a patch that fixes this problem for review, it's attached to the PR (please review at the above URL if interested). I chose EADDRNOTAVAIL as the error code because: (a) The phrase "Can't assign requested address" seems most appropriate (b) It's consistent with what happens when you try to use an IP address that never existed in the first place, e.g., with IP_SENDSRCADDR. (c) You don't normally get this error from a send/write, which is when you'll get it The implementation simply keeps a pointer in the inet PCB to the 'struct in_ifaddr' associated with the local IP address (if any). When this address is removed from the interface, we set the RTF_REJECT flag on it, and this is detected by the TCP and UDP layers. So the per-packet cost is the testing of one flag bit. Note that 'struct in_ifaddr' structures are reference counted, so they continue to exist even after being removed from the interface. -Archie __________________________________________________________________________ Archie Cobbs * Packet Design * http://www.packetdesign.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message