Subject: Cached routes in UDP sockets never die
To: None <tech-net@netbsd.org>
From: Tom Ivar Helbekkmo <tih@eunetnorge.no>
List: tech-net
Date: 10/23/2004 14:40:46
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.
Index: sys/netinet/in_pcb.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/in_pcb.c,v
retrieving revision 1.96
diff -u -r1.96 in_pcb.c
--- sys/netinet/in_pcb.c 29 Sep 2004 21:30:00 -0000 1.96
+++ sys/netinet/in_pcb.c 23 Oct 2004 12:13:46 -0000
@@ -427,8 +427,10 @@
return error;
}
INADDR_TO_IA(ifaddr->sin_addr, ia);
- if (ia == NULL)
+ if (ia == NULL) {
+ in_losing(inp);
return (EADDRNOTAVAIL);
+ }
}
if (in_pcblookup_connect(inp->inp_table, sin->sin_addr, sin->sin_port,
!in_nullhost(inp->inp_laddr) ? inp->inp_laddr : ifaddr->sin_addr,
-tih
--
Tom Ivar Helbekkmo, Senior System Administrator, EUnet Norway Hosting
www.eunet.no T +47-22092958 M +47-93013940 F +47-22092901 FWD 484145