Retrieving local addresses with libnet
Within the libnet library, there are a number of instances where you will need the local addresses (hardware and/or IP addresses). If we were sending a packet, we will need to know the hardware address of the device at the Link layer. For the IP headers, we need to know the IP addresses (either IPv4 or IPv6) so that we can put it in the
Source Address field.
In this recipe, we will show how to retrieve and display the hardware, IPv4, and IPv6 addresses using libnet.
Prior to running the examples in the chapter, we will need to download and install libnet (see the Installing libnet recipe of this chapter). You will also need to add libnet to your project (see the Adding libnet to your project recipe ...