There are a number of sources of debug output that can be enabled to aid in tracing the behavior of the network stack. The following is a list of them:
There are commented out calls to printf
in the file
sys/mbuf.h
in the network stack code. Uncommenting
these lines results in output when mbuf's are allocated
and freed. This is very useful for finding memory leaks.
There are commented out calls to printf
in the file
net/if.h
in the network stack code. Uncommenting
these lines results in output when packets are placed
on or removed from one of the transmit or receive packet
queues. These queues can be viewed as the boundary line
between a device driver and the network stack. If the
network stack is enqueuing packets to be transmitted that
the device driver is not dequeuing, then that is indicative
of a problem in the transmit side of the device driver.
Conversely, if the device driver is enqueueing packets
as it receives them (via a call to ether_input
) and
they are not being dequeued by the network stack,
then there is a problem. This situation would likely indicate
that the network server task is not running.
In the unlikely event that one would actually want to see
TCP state transitions, the TCPDEBUG
macro can be defined
in the file opt_tcpdebug.h
. This results in the routine
tcp_trace()
being called by the network stack and
the state transitions logged into the tcp_debug
data
structure. If the variable tcpconsdebug
in the file
netinet/tcp_debug.c
is set to 1, then the state transitions
will also be printed to the console.
Copyright © 1988-2008 OAR Corporation