A few weeks ago I was debugging network code, and I needed to check if some sockets were bound with SO_REUSEADDR
and/or SO_REUSEPORT
. I researched how I could inspect that, and was surprised to find out that the Linux kernel did not expose those options to userland.
Thankfully, there is a kernel module called knetstat which lets you do this very easily by adding new files into procfs
. When I found it it only supported TCP, but I needed the information for UDP as well so I contributed the code to support it.
SO_{RCV,SND}BUF
.