Subject: kern/27387: Cached routes in UDP sockets never die
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <tih@hamartun.priv.no>
List: netbsd-bugs
Date: 10/23/2004 14:27:26
>Number:         27387
>Category:       kern
>Synopsis:       Cached routes in UDP sockets never die
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 23 12:28:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Tom Ivar Helbekkmo
>Release:        NetBSD 2.99.10
>Organization:
>Environment:
System: NetBSD barsoom.hamartun.priv.no 2.99.10 NetBSD 2.99.10 (BARSOOM) #10: Mon Oct 18 12:38:14 CEST 2004 root@barsoom.hamartun.priv.no:/sys/arch/i386/compile/obj.i386/BARSOOM i386
Architecture: i386
Machine: i386
>Description:
Now that laptops and VPN tunnels are really common, I assume more and
more people are going to experience what I have: that a UDP based
connection cannot migrate between interfaces, such as when a laptop is
taken off its UTP connection, and then moves it default route to a
wireless network instead -- or vice versa.  In my case, it's a VPN
connection that lives on a UDP socket, and it explicitly had to be
taken down and up again every time my connectivity changed, until I
tired of it, and added a call to in_losing() at the place where the
error return for the situation happens.  This flushes the dead route,
and causes the next operation on the socket to do another routing
table look-up, which then gets everything rolling again.
>How-To-Repeat:
Try to keep a UDP session going while migrating the live network
connection back and forth between two interfaces
>Fix:
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,
>Release-Note:
>Audit-Trail:
>Unformatted: