April 2005
Intermediate to advanced
344 pages
11h 59m
English
Once
we
have assembled our protocol blocks, in order from highest-level
protocol to lowest-level protocol, we can write this packet to the
network. We do this using libnet_write( ), as
shown in Example 11-5.
Example 11-5. Writing the packet
/* write the packet */
if ((libnet_write (l)) == -1)
{
fprintf (stderr, "Unable to send packet: %s\n", libnet_geterror (l));
exit (1);
}The libnet_write( ) function causes
libnet to assemble the packet from the protocol
blocks. Then this is sent on the network, either to the IP address
supplied for an injection at the LIBNET_RAW level,
or to the network hardware address if the injection is at the
LIBNET_LINK layer.
Read now
Unlock full access