Re: libnet_write
[email protected] Tue, 8 Jun 2004 21:51:36 +0530
| Newsgroups | gmane.comp.security.libnet |
|---|---|
| Message-ID | <[email protected]> |
Hi Mustafa, Yes I saw that libnet_write_raw_ipv4 is used in your function, but as you said it is not part of 1.1.2.1, then how did it work ? thats confusing ?? So if this worked, then we can use libnet_write_raw_ipv4 directly also, right ? thanks Amit "Mustafa Abu Sedera" <[email protected]> on 06/08/2004 09:54:35 PM To: Amit Kumar Singh/HSS@HSS cc: [email protected], [email protected], [email protected] Subject: Re: libnet_write Hi, libnet_write_raw_ipv4 is an official function in the old libnet API 0.x.x.x not in 1.x.x.x. But if you look carefully in the code you can see that it is used. I used this libnet_adv_write_raw with libnet 1.1.2 and it worked without problems. Regards, Mustaffa Abu Sedira >From: [email protected] >To: "Mustafa Abu Sedera" <[email protected]> >CC: [email protected], [email protected], [email protected] >Subject: Re: libnet_write >Date: Tue, 8 Jun 2004 20:45:45 +0530 > > > > > >thanks mustafa, > > I havent been able to try it out because of time. Just one question, >agreed libnet_adv_write_raw is not an official function, but >libnet_write_raw_ipv4 is an official libnet function, right ? and which >libnet version are we talking of ?, is libnet_write_ipv4 available in >libnet 1.1.2.1, because I use thie version , and I believe this is the >latest. > >regards, >Amit > > > > >"Mustafa Abu Sedera" <[email protected]> on 06/08/2004 08:40:40 PM > >To: Amit Kumar Singh/HSS@HSS, [email protected] >cc: [email protected], [email protected] > >Subject: Re: libnet_write > > > >Hi, >like I wrote before.....if you don't want do build the eth hdr you can use >libnet_adv_write_raw(). >This is nto an "official" function in libnet. I modified the >libnet_adv_write_link() so that it injects the packet to the kernel which >takes care of the eth hdr because i needed it in a program. >You just copy and paste the code at the beginning of your program or in a >header file then use it like an ordinary libnet function. >I suggested before to add it to the libnet API but didn't get any feedback. >Please try it out as it made my job much easier. >here it is again if you have deleted the previous email: > >int >libnet_adv_write_raw(libnet_t *l, u_int8_t *packet, u_int32_t len) >{ > u_int c; > > if (l == NULL) > { > return (-1); > } > > /* assume error */ > c = -1; > > switch (l->injection_type) > { > case LIBNET_RAW4_ADV: > if (len > LIBNET_MAX_PACKET) > { > snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, > "%s(): packet is too large %d\n", __func__, len); > return (c); > } > c = libnet_write_raw_ipv4(l, packet, len); > break; > > case LIBNET_RAW6_ADV: > c = libnet_write_raw_ipv6(l, packet, len); > break; > > default: > snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, > "%s(): advanced raw mode not enabled\n", __func__); > return (-1); > } > > /* do statistics */ > if (c == len) > { > l->stats.packets_sent++; > l->stats.bytes_written += c; > } > else > { > l->stats.packet_errors++; > /* > * XXX - we probably should have a way to retrieve the number of > * bytes actually written (since we might have written >something). > */ > if (c > 0) > { > l->stats.bytes_written += c; > } > } > > return (c); >} >To describe the function again.... >You pass a pointer "packet" which would point to the ip header of a packet >with length "len" (total IP packet length without the eth hdr) and it >writes >the packet to libnet handle "l". > >Regards, >Mustaffa Abu Sedira > > > >From: [email protected] > >To: Aaron Turner <[email protected]> > >CC: "Jee J.Z." <[email protected]>, [email protected] > >Subject: Re: libnet_write > >Date: Mon, 7 Jun 2004 10:01:44 +0530 > > > > > > > > > > > >Hi, > > > > What if I do not want to build the ethernet header. I want the packet >to > >be a raw packet that is handed to ip after the write call. What about > >libnet_write_raw_ipv4, i tihink that is no longer supported, i use libnet > >1.1.2.1. > > Mustafa talked about libnet_write_raw_ipv4, but I can't finds that in >my > >help either, such a function exists ? > > > >thanks > >Amit > > > >_________________________________________________________________ >Tired of spam? Get advanced junk mail protection with MSN 8. >http://join.msn.com/?page=features/junkmail > > > > _________________________________________________________________ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus