From 7e8e7236ecb6d59499ed0d1eee7b5cd4f4cf20f8 Mon Sep 17 00:00:00 2001 From: Dennis Boone Date: Sat, 16 May 2020 22:51:14 -0400 Subject: [PATCH] Turn on keepalive on accepted amlc telnet connections On linux, keepalive defaults off. The default timer on linux is 7200 seconds. Do we need to make a note in the docs about setting /proc/sys/net/ipv4/tcp_keepalive_time? --- devamlc.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/devamlc.h b/devamlc.h index 8e772c5..ea6d5c2 100644 --- a/devamlc.h +++ b/devamlc.h @@ -911,6 +911,9 @@ int devamlc (int class, int func, int device) { optval = 1; if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &optval, sizeof(optval)) == -1) perror("unable to set TCP_NODELAY"); + /* Should we re-set optval here? Any chance it gets modified? */ + if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &optval, sizeof(optval)) == -1) + perror("unable to set SO_KEEPALIVE"); /* these Telnet commands put the connecting telnet client into character-at-a-time mode and binary mode. Since