Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Nov 2002 13:16:01 -0800
From:      Wes Peters <wes@softweyr.com>
To:        Archie Cobbs <archie@dellroad.org>
Cc:        freebsd-net@freebsd.org
Subject:   Re: Sockets and changing IP addresses
Message-ID:  <3DDD4D11.15376311@softweyr.com>
References:  <200211122316.gACNGqWC017440@arch20m.dellroad.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3DDD4D11.15376311>