From owner-freebsd-net Thu Nov 21 13:16: 8 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 34E5337B401 for ; Thu, 21 Nov 2002 13:16:07 -0800 (PST) Received: from softweyr.com (softweyr.com [209.63.227.49]) by mx1.FreeBSD.org (Postfix) with ESMTP id 91F0943E6E for ; Thu, 21 Nov 2002 13:16:06 -0800 (PST) (envelope-from wes@softweyr.com) Received: from homer.softweyr.com ([204.68.178.39] helo=softweyr.com) by softweyr.com with esmtp (Exim 3.35 #1) id 18Eyg4-0002uM-00; Thu, 21 Nov 2002 14:16:00 -0700 Message-ID: <3DDD4D11.15376311@softweyr.com> Date: Thu, 21 Nov 2002 13:16:01 -0800 From: Wes Peters Organization: Softweyr LLC X-Mailer: Mozilla 4.78 [en] (X11; U; Linux 2.4.2 i386) X-Accept-Language: en MIME-Version: 1.0 To: Archie Cobbs Cc: freebsd-net@freebsd.org Subject: Re: Sockets and changing IP addresses References: <200211122316.gACNGqWC017440@arch20m.dellroad.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 Archie Cobbs 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. > Do people agree that my suggestion of returning ENETDOWN is reasonable? Wow. There are other possibilities, EADDRNOTAVAIL or ECONNABORTED. It doesn't matter so long as it the errno is unique to this situation across all syscalls that might encounter it; ENETDOWN seems to meet this criteria. > If so, what would be the most efficient way to implement this? > Obviously we'd like to avoid searching the entire IP address list > for every outgoing packet. Would it work to only do that search if > the socket's cached route is invalid? Etc. My initial reaction is this should take care of the problem, but I haven't backed that up with any testing. SIOCSIFADDR on an interface does remove all routes for the interface and then rebuild routes for all now-existing addresses, so any cached routes on that interface will now be invalid. -- "Where am I, and what am I doing in this handbasket?" Wes Peters Softweyr LLC wes@softweyr.com http://softweyr.com/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message