This module allows one to drop TCP connections and can be usefull for killing TIME-WAIT
sockets.
First compile and load the module:
$ make
$ sudo insmod drop-tcp-sock.ko
Single socket killing:
# netstat -n -t | grep WAIT
tcp 0 0 127.0.0.1:50866 127.0.0.1:22 TIME_WAIT
# echo "127.0.0.1:50866 127.0.0.1:22" >/proc/net/tcpdropsock
Multiple sockets killing:
# netstat -n -t | grep WAIT | awk '{print $4"\t"$5}'
127.0.0.1:41278 127.0.0.1:22
127.0.0.1:41276 127.0.0.1:22
127.0.0.1:41274 127.0.0.1:22
# netstat -n -t | grep WAIT | awk '{print $4"\t"$5}' >/proc/net/tcpdropsock
- 2.6.32+ kernels
- network namespaces support
- batch socket killing (multiple at once)
Original idea: Roman Arutyunyan
This module implementation: Ilya V. Matveychikov
2018, 2019, 2020