How does libnet_adv_write_link work?

<[email protected]> 30 Mar 2004 09:54:03 -0000
Newsgroups gmane.comp.security.libnet
Message-ID <[email protected]>

Hi,

Please excuse my ignorance. I have this doubt: I checkd the code
and basically it is calling sendto() with the packet we want to be sent in buffer field. I another thread just last week, (http://www.securityfocus.com/archive/89/358085/2004-03-20/2004-03-26/0)
I read that, a captured packet can be just given as input to libnet_adv_write_link() without extracting src and dst ip addresses and ports. If a tcp packet is given as input to libnet_adv_...() wouldn't it add its own header since it is eventually calling sendto() ? Please shed some light on me. 

According to the above mentioned thread I understood that if I have a tcp packet captured, I can send it like this :

libnet_init(....);
libnet_adv_write_link(.., /*captured tcp packet, /*size of captured tcp packet*/);

is this right?

thank you
bf2