Re: Cannot send an ethernet II packet.

Mike Schiffman <[email protected]> Thu, 13 May 2004 00:13:18 -0700
Newsgroups gmane.comp.security.libnet
Message-ID <[email protected]>
Hard to say with the limited information. First try the sample programs 
that use the link layer interface. How do they look? If they work as 
expected, your code is probably broken. Also check your OS/Version? Is 
it supported?

On May 9, 2004, at 8:50 PM, <[email protected]> wrote:

>
>
> Greetings everyone,
>
> I have a problem using libnet 1.1.2. I am developping a tool in which 
> I am crafting layer 2 packets.
>
> After doing some monitoring with ethereal, I noticed that none of the 
> packets I was trying to craft with libnet_autobuild_ethernet or 
> libnet_build_ethernet were correct. Ethereal always reports a wrong 
> type of 0x0003 instead of 0X0800 (which is IP protocol).
>
> I know that you are going to say that's an endian problem and I forgot 
> the host to network conversion but I did not :-).
>
> Here is how I initialize my context and create the protocol blocks: 
> (it's "hard coded" in the application while I am doing debugging)
>
> /* initialize context */
> libnet_init(LIBNET_LINK, "eth0" , errbuf)
>
> /* create IPv4 block */
> libnet_autobuild_ipv4(computeSize(), prot, dest, packet->context);
>
> /* create ethernetlII block */
> libnet_autobuild_ethernet(dest, type, packet->context)
>
> I tried different things for "type": 0x0800, htons(0x0800) and even a 
> fake value such as 0x0555.
>
> Everytime, ethereal reports this:
> "Protocol: unknown (0x0003) ".
>
> If you have any idea where the mistake is...
>
> Best regards.
>
>
--
Mike Schiffman, CISSP
http://www.packetfactory.net/schiffman
Doveryay No Proveryay