Michael Tüxen
Contact
Email: <tuexen AT freebsd DOT org>
TCP Black Box Logging (BBLog)
An overview of BBLog is available in Adventures in TCP/IP: TCP Black Box Logging.
Enabling BBlog for Debugging TCP Panics
For catching bugs in the TCP stack, which result in a panic, one can enable BBlog for all TCP connections such that the logs are stored in a per endpoint ringbuffer. Once the panic occurs, one can extract that information from a core. Configuration of BBLog in this case is done via setting sysctl variables. This can be done for all future TCP endpoints on the command line by executing
sysctl net.inet.tcp.bb.log_auto_all=1 sysctl net.inet.tcp.bb.log_auto_ratio=1 sysctl net.inet.tcp.bb.log_auto_mode=1
or by putting
net.inet.tcp.bb.log_auto_all=1 net.inet.tcp.bb.log_auto_ratio=1 net.inet.tcp.bb.log_auto_mode=1
in the file /etc/sysctl.conf and reboot. The first two settings enable BBLog for all TCP endpoints and the third setting choose the mode TCP_LOG_STATE_TAIL. It is preferred to set the variables via /etc/sysctl.conf, since it applies to all TCP servers started automatically during boot.