Subject: Re: IP-in-TCP?
To: None <tech-net@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-net
Date: 02/02/2005 13:09:08
>> I ended up hacking an option into the kernel so I could have it
>> *always* do keepalives whether userland requested them or not
> That would be useful.  Every so often I come across apps that don't
> have a convenient config file option..

Here's the patch I use.  It's for 1.4T, but looking at 2.0 it looks as
though the code is very nearly identical, so the corresponding patch
should be very similar.

/*	$NetBSD: tcp_timer.c,v 1.45 1999/07/14 22:37:15 itojun Exp $	*/
--- OLD/sys/netinet/tcp_timer.c	Thu Jan  1 00:00:00 1970
+++ NEW/sys/netinet/tcp_timer.c	Thu Jan  1 00:00:00 1970
@@ -469,7 +469,10 @@
 		else if (tp->t_in6pcb)
 			so = tp->t_in6pcb->in6p_socket;
 #endif
-		if (so->so_options & SO_KEEPALIVE &&
+		if (
+#ifndef FORCE_TCP_KEEPALIVES
+		    so->so_options & SO_KEEPALIVE &&
+#endif
 		    tp->t_state <= TCPS_CLOSE_WAIT) {
 		    	if ((tcp_maxidle > 0) &&
 			    (tp->t_idle >= tcp_keepidle + tcp_maxidle))

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B