Re: libnet doubt

[email protected] Tue, 15 Jun 2004 19:36:08 +0530
Newsgroups gmane.comp.security.libnet
Message-ID <[email protected]>



christ!

so the only thing i wasnt doing was "not returning SUCCESS b4 the label bad
: " !!! ;-)
Its working now


thanks
Amit





"Jee J.Z." <[email protected]> on 06/15/2004 07:41:56 PM

To:    Amit Kumar Singh/HSS@HSS
cc:

Subject:    Re: libnet doubt


Hi Amit,

In this way by calling build_send_udp() consecutively, lh has been
destroyed
after you call the first. Isn't it?

Jee

----- Original Message -----
From: <[email protected]>
To: "Jee J.Z." <[email protected]>
Sent: Tuesday, June 15, 2004 12:38 PM
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
>
>
> "DISCLAIMER: This message is proprietary to Hughes Software Systems
Limited
> (HSS) and is intended solely for the use of the individual to whom it is
> addressed. It may contain  privileged or confidential information and
> should not be circulated or used for any purpose other than for what it
is
> intended. If you have received this message in error, please notify the
> originator immediately. If you are not the intended recipient, you are
> notified that you are strictly prohibited from using, copying, altering,
or
> disclosing the contents of this message. HSS accepts no responsibility
for
> loss or damage arising from the use of the information transmitted by
this
> email including damage from virus."
>
>