Re: libnet doubt
[email protected] Tue, 15 Jun 2004 17:33:34 +0530
| Newsgroups | gmane.comp.security.libnet |
|---|---|
| Message-ID | <[email protected]> |
Hi, I tried doing this : after sending every UDP packet, I call, libnet_clear_packet(lh);, then in build_send_udp I set udp_ptag and ip_ptag to zero before calling libnet_build_udp or libnet_build_ipv4. But still, I am noe getting an error with libnet_write(). it says : write error : injection type not supported. this is really wierd, is sending two consecutive udp packets so difficult, help section is not helping much since it is not very comlpete .. can someone point out as to what am I doing wrong, and give me a well defined wy of sending more than one packet(any protocol) on the same context(i.e without having to do a libnet_init and libnet_destroy every time I send a packet). thanks Amit Amit Kumar Singh 06/15/2004 05:08 PM To: "Jee J.Z." <[email protected]> cc: Subject: libnet doubt ---------------------- Forwarded by Amit Kumar Singh/HSS on 06/15/2004 05:16 PM --------------------------- Amit Kumar Singh 06/15/2004 04:27 PM To: "Mustafa Abu Sedera" <[email protected]> cc: [email protected] Subject: libnet doubt (Document link: Amit Kumar Singh) Hi, I am trying to do this : libnet_t lh; libnet_ptag_t udp_ptag=0, ip_ptag=0; u_long dst_ip; build_send_udp() { udp_ptag=0; udp_ptag=libnet_build_udp( ...... ); if(udp_ptag==-1) {printf("we're goig to bad from here udptag");goto bad;} ip_ptag=libnet_autobuild_ipv4(....); if(ip_ptag==-1) {printf("\nwe're going to abd from iptag\n");goto bad;} bad: destroy (lh); exit; } main() { char * dst="192.x.x.x"; lh=libnet_init(libnet_raw4 , NULL, err_buf); dst_ip=libnet_name2addr(lh, dst, DONT_RESOLVE); build_send_udp(); build_send_udp(); build_send_udp(); libnet_destroy(lh); } WHAT I AM TRYING TO DO : basically i am trying to send more than one udp packets from the same context. What I do is this : 1. first in main initialize using libnet_init, the handle is a global variable accessible to build_send_udp() too. 2. then send a udp packeteverytime build_send_udp is called. 3 finally after all 3 packets have been sent, destroy the context using libnet_destroy(lh); PROBLEM : On running the .out, the first packet goes out fine, but for the second, third (all after first ) I get the following error : We're going to bad from iptag cannot build ip header : libnet_get_ipaddr4() : ioctl : no such device .... what is this can someone tell me how to send more than one packet from the same context. i tried adding libnet_clear_packet(lh); after every call to build_send_udp(), but the same error persists. Any clues ? thanks Amit