Subject: Re: Cached routes in UDP sockets never die
To: None <tech-net@NetBSD.org>
From: David Young <dyoung@pobox.com>
List: tech-net
Date: 10/23/2004 11:42:13
On Sat, Oct 23, 2004 at 02:40:46PM +0200, Tom Ivar Helbekkmo wrote:
> I've just submitted kern/27387, which addresses a problem with the
> handling of UDP sockets when the underlying IP connectivity moves from
> one interface to another -- as when a laptop is taken off its UTP
> connection, and regains access to the net over wireless, or the other
> way around. An active UDP socket that this happens under will keep
> trying to use the dead interface, because, unlike for TCP, there is no
> mechanism to detect the situation and re-lookup the route.
>
> The patch in kern/27387, included below, adds a call to in_losing() at
> the right point, thus resolving the situation.
This is not another instance of kern/3508?
Speaking of 3508, rtalloc looks broken to me.
void
rtalloc(struct route *ro)
{
if (ro->ro_rt && ro->ro_rt->rt_ifp && (ro->ro_rt->rt_flags & RTF_UP))
return; /* XXX */
ro->ro_rt = rtalloc1(&ro->ro_dst, 1);
}
To avoid a memory leak, it should not be this?
void
rtalloc(struct route *ro)
{
if (ro->ro_rt && ro->ro_rt->rt_ifp && (ro->ro_rt->rt_flags & RTF_UP))
return; /* XXX */
if (ro->ro_rt != NULL)
RTFREE(ro->ro_rt);
ro->ro_rt = rtalloc1(&ro->ro_dst, 1);
}
Dave
--
David Young OJC Technologies
dyoung@ojctech.com Urbana, IL * (217) 278-3933