While developing your driver, you will want to test that either receiving or transmitting is working before both are. Since your driver is not yet capable of handling round-trip network traffic, you have to use different tools to check these two cases. You will likely be using plenty of logging in your driver as well to make sure things are working as you expect.
To verify that your driver is receiving packets, you can use the ping utility from the debug host to send packets to the target machine, and use logging in the driver’s packet-reception code to verify that packets are being received. Running ping normally performs an ARP request to get the hardware address for the target. If your driver can’t transmit yet, ping will fail if you did not set up a static IP address binding with the arp command. If you do not want to set up a static IP address binding, you can run ping on the broadcast address for the private network, bypassing address resolution.
To verify that your driver is sending packets, you can use ping on the target machine to send packets to the debug host. If your driver does not yet support receiving, you can use the tcpdump utility on the debug host to verify that packets are coming from the target machine. To do this, specify the -v flag for verbose output, and the -i flag to name the interface to examine.
Note: You must be logged in as root, or preface your command with sudo, to set up a network interface
If the debug machine is connected to the target on the interface en2, for example, you would enter this command:
# tcpdump -v -i en2 |
With tcpdump running, you can start ping on the target machine and examine the output of tcpdump on the debug host. If there is no output, your driver is not transmitting. If there is output, verify that the IP address for your driver’s network interface on the target system appears in the output. If it does, your driver is successfully transmitting packets.
Once your driver can both receive and transmit, you can just use ping without setting up static IP address binding, and perform tests to verify data integrity.
Last updated: 2008-03-11