Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add TCP keepalive socket options support
Add support for printing tcp_keepalive_intvl, tcp_keepalive_probes and tcp_keepalive_time. keepalive_time and keepalive_intvl have to be divided by HZ as they are multiplied by that value in the kernel code before being stored: net/ipv4/tcp.c: tp->keepalive_time = val * HZ; tp->keepalive_intvl = val * HZ; This is quite useful to inspect if an application overrides default keepalive values somewhere in its code from system defaults which are usually quite high (2 hours for tcp_keepalive_time by default). If a given value is 0 the kernel takes a sysctl value for that parameter instead and knetstat will not print that value at all with this change. Example: tcp_keepalive_intvl = 15 tcp_keepalive_probes = 2 tcp_keepalive_time = 15 output: // ... SO_KEEPALIVE=1,TCP_KEEPIDLE=15,TCP_KEEPCNT=2,TCP_KEEPINTVL=15
- Loading branch information